June 16, 2007

Ajax toolkit new release

Microsoft has release another version of its Ajax toolkit.. it includes really cool new controls like DropdowList, calendar control and more.. you can download and see the sample from the this location.. http://ajax.asp.net/ajaxtoolkit/

June 13, 2007

File Upload Control with Ajax update panel

FileUpload control in ASP.NET doesn't work properly on Ajax update control. It does nothing when we're try to upload a file. But you can fix that quickly just by adding a trigger to it.  check the below code...

   1:  <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional">
   2:                              <Triggers>
   3:                                  <asp:PostBackTrigger ControlID="Button1" />
   4:                              </Triggers>
   5:                              <ContentTemplate>
   6:                                  <asp:FileUpload ID="FileUpload1" runat="server" Width="275px" />
   7:                                  <asp:Button ID="Button1" runat="server"
   8:                                      Text="Upload" CssClass="FlatButton" OnClick="Button1_Click" />
   9:                              </ContentTemplate>
  10:                          </asp:UpdatePanel>

June 7, 2007

C# 3.0 - Automatic Properties

Creating loads of get,set to properties is always a pain. I had my own macro do that.. but with c# 3.0 automatic properties will take care of that. This will avoid us manually create private variables and assign them to get,set. The c# 3.0 compiler will create them automatically.
So the new Property code will look something like this..

public class Car {
public string CarModel {
get;
set;
}

public int MakeYear {
get;
set;
}
}

June 3, 2007

Web application project support in VS 2005

I thought that Web application projects doesn't exists in VS 2005, like it does in VS 2003. Well, im not quite right.... once you have installed VS 2005 SP1, you will get that feature in File & New Project. I like web application projects becoz its speed up the compilation and I can easily tier the application. you can download VS 2005 SP 1 here.

June 1, 2007

Microsoft Surface

Microsoft newest product, "Microsoft Surface".

http://www.microsoft.com/surface/

ref: http://weblogs.asp.net/scottgu/archive/2007/05/30/microsoft-surface-and-wpf.aspx

Writing IIS Host headers in C#

code for writing IIS host headers. You have to pass the host header value and the web site ID, and also you should provide the username and password.

public static void AddHostHeader(string hostHeader, string websiteID) {
DirectoryEntry site = new DirectoryEntry("IIS://localhost/w3svc/" + websiteID, "username", "password", AuthenticationTypes.None);
try {
PropertyValueCollection serverBindings = site.Properties["ServerBindings"];
serverBindings.Add(hostHeader);
Object[] newList = new Object[serverBindings.Count];

serverBindings.CopyTo(newList, 0);
site.Properties["ServerBindings"].Value = newList;
site.CommitChanges();
} catch (Exception e) {
throw e;
}
}

Google gears

need to search offline ?? try google gears..