vuyiswam
July 24th, 2009, 03:13 AM
Good Morning All
I have the following code that find the controls in my page
Find Windows Control
Control control = null, c = null;
foreach (string ctl in Page.Request.Form)
{
c = Page.FindControl(ctl);
if (c is System.Web.UI.WebControls.Button)
{
control = c;
break;
}
}
this Works for buttons i have my form , so i have changed my page and i have added image buttons and i want find them in my page like this
Control control = null, c = null;
foreach(string ctl in Page.Request.Form)
{
c = Page.FindControl(ctl);
if (c is System.Web.UI.WebControls.ImageButton)
{
control = c;
break;
}
}
This does not work, the image buttons in my page are not found the "control " is always null.
and the above code i have to use it here
if ((control == null) || ((!(control.ID.Contains("btnApplyToSelected_"))) && (!(control.ID.Contains("btnSaveConstraints_")))))
{
lstbxFilter_SelectedIndexChanged(sender, e);
loadConstraintsXM();
}
Thank you
I have the following code that find the controls in my page
Find Windows Control
Control control = null, c = null;
foreach (string ctl in Page.Request.Form)
{
c = Page.FindControl(ctl);
if (c is System.Web.UI.WebControls.Button)
{
control = c;
break;
}
}
this Works for buttons i have my form , so i have changed my page and i have added image buttons and i want find them in my page like this
Control control = null, c = null;
foreach(string ctl in Page.Request.Form)
{
c = Page.FindControl(ctl);
if (c is System.Web.UI.WebControls.ImageButton)
{
control = c;
break;
}
}
This does not work, the image buttons in my page are not found the "control " is always null.
and the above code i have to use it here
if ((control == null) || ((!(control.ID.Contains("btnApplyToSelected_"))) && (!(control.ID.Contains("btnSaveConstraints_")))))
{
lstbxFilter_SelectedIndexChanged(sender, e);
loadConstraintsXM();
}
Thank you