V
Visual Systems AB \(Martin Arvidsson\)
Hi!
Enclosed code gives me a compiler error with the text
"Argument '1': cannot convert from 'System.Web.UI.ControlCollection' to
'System.Web.UI.Control'" and also
"The best overloaded method match for
'ArchitectDev.custdetail.AssignJavaScript(System.Web.UI.Control)' has some
invalid arguments"
<--- CODE START --->
private void AssignJavaScript(System.Web.UI.Control ctrl)
{
foreach(System.Web.UI.Control c in ctrl.Controls)
{
if(c is TextBox)
{
((TextBox)c).Attributes.Add("OnChange", "DoChange");
}
AssignJavaScript(c);
}
}
private void Page_Prerender(object sender, System.EventArgs e)
{
AssignJavaScript(this.Controls);
}
<---CODE END -->
Just cant understand why, its the this.Controls it doesn't like...
How can i add the Page_Prerender to the PreRender event?
Do i have to do it manually or can i select the function in a property
editor?
Should i set this in Page_Load?
Regards
Martin Arvidsson
Enclosed code gives me a compiler error with the text
"Argument '1': cannot convert from 'System.Web.UI.ControlCollection' to
'System.Web.UI.Control'" and also
"The best overloaded method match for
'ArchitectDev.custdetail.AssignJavaScript(System.Web.UI.Control)' has some
invalid arguments"
<--- CODE START --->
private void AssignJavaScript(System.Web.UI.Control ctrl)
{
foreach(System.Web.UI.Control c in ctrl.Controls)
{
if(c is TextBox)
{
((TextBox)c).Attributes.Add("OnChange", "DoChange");
}
AssignJavaScript(c);
}
}
private void Page_Prerender(object sender, System.EventArgs e)
{
AssignJavaScript(this.Controls);
}
<---CODE END -->
Just cant understand why, its the this.Controls it doesn't like...
How can i add the Page_Prerender to the PreRender event?
Do i have to do it manually or can i select the function in a property
editor?
Should i set this in Page_Load?
Regards
Martin Arvidsson