Sunday, October 25, 2009

Open a New Window On Server Side using Javascript Code in Asp.net

· 1 comments

// open new window with specified path

function OpenWindow(url)

{
newwindow = window.open(url, 'mywindow', 'width=500,height=400');

}

Now In .aspx.cs page or server side to use the javascript window open you have to use the following code

StringBuilder popupScript = new StringBuilder();
popupScript.Append("");
// if you are using script manager - update panel then this
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "PopupScript", popupScript.ToString(), false);
//else
Page.RegisterStartupScript("PopupScript", popupScript.ToString());

Read More......

Saturday, October 24, 2009

Add "Select" Option To Dropdown list in Asp.net

· 0 comments

There are many ways to add select option to dropdown list.. Here in this post i will list some of the ways: 1) Select 2) ddltemp.Items.Add(new ListItem(”Select”, “0")); 3) ddltemp.Items.Insert(0, new ListItem(”Select”, “0")); 4) ddltemp.Items.Insert(0, "--Select--"); ddltemp.Items[0].Value = "0";

Read More......