c# - How to use my CustomControl with javascript inside a gridview inside an update panel? -
I'm having trouble when I want to add my custom control to a gridview and an updatePanel. The Javascript function is never added to the page even if I type it directly inside the render content method.
UpdatePanel GridView EditItem CustomControl
[ToolboxData ("& lt; {0}: Test Controll Runat (Public Domain)> Public Class Test Control: WebConnect {Safe Override Zero OnInit (EventArgs e) {base.OnInit (e); < / P> Can someone help me? Cheers.
string script = "& lt; SCRIPT ty pay = \" text / javascript \ "& gt; \ n" + "function show_" + ClientID + "() {alerts ('toto' );} "+" & Lt; / SCRIPT & gt; \ n "; if (Page.ClientScript.IsClientScriptBlockRegistered (" show_ "+ ClientID)) Page.ClientScript.RegisterClientScriptBlock (Page.GetType ()," show_ "+ ClientID , Script);} Protected Override Zero RenderContents {HtmlTextWriter Writer} {author.WriteLine ("& lt; a href = \" javascript: show_ "+ ClientID +" (); \ "& gt; Click & lt; / a & gt;") ;}}
It seems that if the existence of your script block is being checked, then enter the script block only when it already exists .
I think if the statement and see what happens.
Comments
Post a Comment