Friday, December 17, 2010

How to set the focus on controls when ajax toolkit modal popup comes true

1)In which control you want to focus set this as behaviour id of modalpopup
2)use this code block
In following example we set the focus on emergency code text box.

if ((!Page.ClientScript.IsStartupScriptRegistered("Startup"))) {
StringBuilder sb = new StringBuilder();
sb.Append("");
Page.ClientScript.RegisterStartupScript(Page.GetType(), "Startup", sb.ToString());

Thanks
Mahesh K. Sharma

How to add buttons for fullpost back in gridview while using update panels

1)
Add following code on row_databound

ImageButton ImageButtonDocumentDownLoad = (ImageButton)e.Row.FindControl("ImageButtonDocumentDownLoad");

ScriptManager scriptManager = ScriptManager.GetCurrent(this);
scriptManager.RegisterPostBackControl(ImageButtonDocumentDownLoad);

//If grid view in user control

2)
ScriptManager scriptManager = new ScriptManager();
scriptManager.RegisterPostBackControl(ImageButtonDocumentDownLoad);

Thanks
Mahesh K. Sharma