Thursday, April 10, 2008

Recursively find control from previous page

hi

i study more time asp.net starter kit and i found best code for finding previous page server control.

But from prevoius page you must use postbackurl on button or use server.transfer(”go.aspx”);

The code is follow……..

public sealed class Util{
private Util(){}
public static Control FindControlRecursively(string controlID, ControlCollection controls){

if (controlID == null || controls == null)
return null;
foreach (Control c in controls)
{ if (c.ID == controlID)
return c;
if (c.HasControls())
{
Control inner = FindControlRecursively(controlID, c.Controls);
if (inner != null)
return inner;
}

}

return null;
}
}

No comments :

Post a Comment

AJAX, asp, Asp.net, asp.net and sql server security, Asp.net IntemIndex, C#, Css, DataBinder.Eval, DataKeyNames, Datalist, Datapager, DataSet, DataTable, DropDownList, FindControl, gridview, JavaScript, jquery, Listview, Paging, Regex, RegularExpression, Repeater, Server side validation, Sql Server, timer, timercallback, Validation, XML, xmlnode, XPath