Wednesday, April 9, 2008

Recursively find control from previous page


i study more time 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........


[sourcecode language="csharp"]

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,, and sql server security, 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