tag:blogger.com,1999:blog-5602263760491785758.post7811320853684515564..comments2023-06-28T01:39:03.668-07:00Comments on DevArchive.net Blog: Using IScriptControl interface with UserControls in ASP.NET AJAX Applications.Kirill Chilingarashvilihttp://www.blogger.com/profile/09906215698720468631noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-5602263760491785758.post-41861269533638945342011-12-08T04:30:54.134-08:002011-12-08T04:30:54.134-08:00Yeah, really big thanks for example!
As for troub...Yeah, really big thanks for example!<br /><br />As for trouble with $find (i.e. $find(ClientID) returns null because no client content tags generated with id=ClientID) - here is a new Render method to solve this problem (and no Panel need to put there).<br /><br /> protected override void Render(HtmlTextWriter writer)<br /> {<br /> writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);<br /> writer.RenderBeginTag(HtmlTextWriterTag.Div);<br /> base.Render(writer);<br /> writer.RenderEndTag();<br /><br /> ScriptManager.GetCurrent(Page).RegisterScriptDescriptors(this);<br /> }Stranghttps://www.blogger.com/profile/16609928586796727334noreply@blogger.comtag:blogger.com,1999:blog-5602263760491785758.post-42473486669830534552010-04-16T14:12:30.405-07:002010-04-16T14:12:30.405-07:00Gooma,
I ran into the same problem and I solved i...Gooma,<br /><br />I ran into the same problem and I solved it by wrapping the contents of my control in a asp:Panel and then declared my ScriptControlDescriptor (in the GetScriptDescriptors method) with the client ID of that new panel.<br /><br />Dim descriptor As ScriptControlDescriptor = New ScriptControlDescriptor("MyNamespace.MyControl", Panel.ClientID)<br /><br /><br />This is a cool trick. Thanks!<br /><br />-ScottAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5602263760491785758.post-53801210822608040522009-10-25T06:38:04.224-07:002009-10-25T06:38:04.224-07:00The problem is that actually there is no control w...The problem is that actually there is no control with that id. Render function renders only the insides of user control. Therefore i can't call my js functions. In the rendered source i can see that the object is created <br />$create(AjaxTest.ClientControl, {"PageSize":15}, null, null, $get("TestControl1"));<br /><br />But i can't get reference to it by calling $find or anything else.Unknownhttps://www.blogger.com/profile/16815344615244111282noreply@blogger.comtag:blogger.com,1999:blog-5602263760491785758.post-9939081507202642092009-10-14T13:32:33.687-07:002009-10-14T13:32:33.687-07:00Hi gooma,
you can use the $find shortcut function...Hi gooma,<br /><br />you can use the $find shortcut function to get reference to Sys.Components :<br /><br />$find('controlid').MyFunction()<br /><br />The Sys.Component have to mbe registered with 'controlid' id.Kirill Chilingarashvilihttps://www.blogger.com/profile/09906215698720468631noreply@blogger.comtag:blogger.com,1999:blog-5602263760491785758.post-48990292571188088692009-10-14T13:15:49.981-07:002009-10-14T13:15:49.981-07:00Hi. I followed your instructions but i can't d...Hi. I followed your instructions but i can't do what i originaly intended to do. My point was to expose a javscript api for other controls. I wanted to do this:<br />getElementById("controlid").MyFunction(). Unfortunately i always get a null reference.Unknownhttps://www.blogger.com/profile/16815344615244111282noreply@blogger.com