DCSIMG
Ran Savariego

Ran Savariego


<RS:Web programming runat="Server" />

Silverlight for Linux Desktop - Moonlight project

It seems that silverlight is on the right way while Novell and MS implementation silverlight support for linux machines.

The linux silverlight project calls "Moonlight", you can get more info here

MSDN screencast - exploring hot topic,in 10-15 minutes

For those of you that are not familiar with screencast, http://www.microsoft.com/uk/msdn/screencasts/default.aspx

 "Don't have the time to read a 10-page how-to article or watch a full length webcast? Try an MSDN screencast, a webcast that takes you step-by-step to discovering new functionality or exploring a hot developer topic, all in 10-15 minutes. View them online now or download for later reference."

 Have fun

Posted: Dec 01 2008, 05:05 AM by Ran Savariego | with no comments
תגים:,

Problem when using AddWebPart

It seems that there is no way to dynamically add webpart in post request.

Writing something like that no going to do the job WebPart myWebPart = WebPartManager1.CreateWebPart(userControl);
WebPartManager1.AddWebPart(myWebPart, WebPartZone1, 0);

(on the next request you are not going to see the added webPart)

Why? In brief - it related to view state of the new control and page lifecycle

How to solve it?

There is a need to call SetPersonalizationDirty(); after adding the new webpart.

One problem SetPersonalizationDirty() is not a public method in webPartManager class (protected.)

So, how to solve it?

1. Create your own WebPartManager by inherit MS WebPartManager

2. Add new method as public that calls SetPersonalizationDirty

public void setDirty()
 {
   SetPersonalizationDirty();
 }

3. Replace the WebPartManager control on your page by using register tag

<@ Register TagPrefix="Mytag" Assembly="MyAssembly" Namespace="MyNamespace" %>

Have fun

 

להיות בלוגר בשב"כ ...

 קבלו את נ', א', ח' וי'  :)

http://www.shin-tech.org.il/

Develop games with GDK and VS2008

http://gdk.thegamecreators.com/

Debug .NET Framework libraries

Hi,
Microsoft has released .Net reference source code, which enable you to debug straight into .net framework code.
 
It is easier with VS2008 but and also possible via VS2005.

Detailed post can be found on Shawn Burkre's blog

 

Cheers,
Ran

 

Nice web lab project - convert VB.Net to C#

Nice web tool that helps you to convert vb.net code to c# and c# to vb.net on the fly

http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx

Cheers,

Ran

MS Messenger embed into your web site

Microsoft has released lately a messenger "user control" that you can add into your web site.

The application is going to be embedded as iframe into your web site -  click here to config the iframe

 

 

Using ReSharper with Visual Studio 2005 & 2008 on the same machine

Lately I'm working with VS 2008 & VS 2005 on the same machine - no issues until now ... :)

After installing VS2008, ReSharper 3.0 didn't seem to be working - why? - because there are 2 version of ReSharper 3.0 one for 2005 and one for 2008 - there is a need to install both of them. after find out that it work also with 2008.

BTW - The 3.0 version doen't have support for c# 3.0 features.

Cheers,
Ran

 

How to register to partial-page rendering AJAX events.

While using AJAX.Net and specifically while using PageRequestManager there are several events that we can use.

  • beginRequest - event the raised before any server request.
  • endRequest - event that raised after the sever request end.
  • pageLoaded - event after all page content is refreshed
  • pageLoading - raised after endRequest but before pageLoaded.

 When we can use it?

Anytime when you want to do JS code before/after AJAX call -  

 Example: 

For example if you like to show loading icon while calling server request and hide it when done.

we just need to register to add_beginRequest and add_endRequest events and do the needed JS code there. 

 

The Icon that will be present on the UI: <div id="LoadingIcon"><img src="../Images/loader.gif" id="loader" /></div>

<script type="text/javascript" language="javascript">
with(Sys.WebForms.PageRequestManager.getInstance()) {

add_beginRequest(onBeginRequest); //regester to the begin Request
add_endRequest(onEndRequest); // regester to the end Request
}
</script>

 //JavaScript Code
function onBeginRequest(sender, args) {
try
{
var win = $get("mainTable");var winBounds = Sys.UI.DomElement.getBounds(win);
var x = Math.round (winBounds.width /2) ;
var y = Math.round(winBounds.height / 2);
Sys.UI.DomElement.setLocation($get(
"loader"),x,y);
$get(
"LoadingIcon").style.top = winBounds.y;$get("LoadingIcon").style.left = winBounds.x;
$get(
"LoadingIcon").style.width = winBounds.width ;
$get(
"LoadingIcon").style.height = winBounds.height;$get("LoadingIcon").style.display = '';
}
catch (e){}
}

//after the request ends - hide the loading icon
function
onEndRequest(sender, args) { setTimeout("$get('LoadingIcon').style.display = 'none'",0);}

I saved an Alien

Well ..., I made it, his name is Po.

 

 And for those who are not familiar with the community - no I didn't lose my mind, I have just saw Yosi's last post (Video), and one of the things that he talked about there was about SaveAnAlien.com project - I said let's give it a try ...

 Check this out yourself

 Cheers.

FaceBook.Net

Nikhil Kothari developed a nice framework, for developing Facebook applications using ASP.NET and C#.

You can find the open source project @ codeplex 

 

Cheers.

Visual Studio 2008 and .NET 3.5 - Download Links

Microsoft released VS 2008 and Framework 3.5 (C# 3.0) 2 days ago. and one of the best things I've found there is JavaScript Intellisense

You can download trial editions for 90 days

For Visual Studio 2008 Express (free) click here

For Visual Studio 2008 Professional Edition click here 

For Team Foundation Server click here

For Visual Studio 2008 Team Suite click here

For Framwork 3.5 click here

 

Cheers.

AJAX Debugging

I'm sure you know about the JavaScript debugger command that enable you to open a JavaScript debugger whenever you wrote it on your code .

But Are you familiar with AJAX Debug class - the Sys.Debug?

The simple method is Sys.Debug.trace(message) - the trace method will show the trace message on VS console window, and will look for Html control with TraceConsole id : <textarea id="TraceConsole"></textarea> on the page, if there is it will add the trace message there.

Sys.Debug.assert(condition, message, displayCaller) - the assert method, will show a message in case the condition is false, and asked if you would like to debug the code.
The displayCaller (bool parameter) - To show or not the function name that call assert method, as part of the debug message

Sys.Debug.fail(message) - will open the debugger and add the message to the debugger window.

Cheers.

C# 3.0 Anonymous Types - Are we going back to JS?

In my previous post I've talked about new feature in C# 3.0 - Extension Methods and while cont' playing with Framework 3.5, I notice a new keyword - var, What is var? I know var from JavaScript, what it's doing in C#? :)

So, var in C# is object initializer means it specifies the values from one or more fields and properties of an object.

For Example: 

var Employe = new {First_Name = "Kuku", Last_Name = "The King", Age = 89};

The compiler will create an anonymous type at complie time that will be somthing like that:

class __AnonymousTypes
{
   private string last_Name;
   private string first_Name;
   private int age
   public string Last_Name{ get { return last_Name;} set { last_Name= value ; } }
   public string First_Name{ get { return first_Name;} set { first_Name= value ; } }
   public int Age{ get { return age} set { age= value ; } }
}
__AnonymousTypes p1 = new __AnonymousTypes();
Employe.First_Name = "Kuku";
Employe.Last_Name = "The King";
Employe. Age = 89;

 
Well, I don't see a massive usage with the feature. (I didn't want to say any :))

Cheers.

 

More Posts Next page »