lamy Posted February 6, 2006 Posted February 6, 2006 lets say i have several instances of the same custom control and i wanted the first one to load something and ignore that procedure with the rest of the custom control since its already loaded, anyone for directions? was thinking of putting this in my custom control <script language="javascript" src="something"></script> but i wanted it to load only once even if i keep dragging more of the same custom control, anyone? i can do a workaround like saving something in a session/viewstate, then check it from there, but there could be another way Quote slow down when you need to hurry, stop when you need to move on, look back when you need to forget, or you might slip and leave sanity
lamy Posted February 8, 2006 Author Posted February 8, 2006 found an article for the solution, it was to emit it once for all server controls, however i keep on getting this "obsolete" warning at "Page.RegisterClientScriptBlock" line, im using VS 2005 Express Const displayScriptKey As String = "someScript" If Not Page.IsClientScriptBlockRegistered(displayScriptKey) Then Page.RegisterClientScriptBlock(displayScriptKey, script) End If Quote slow down when you need to hurry, stop when you need to move on, look back when you need to forget, or you might slip and leave sanity
lamy Posted February 8, 2006 Author Posted February 8, 2006 *** resolved Const displayScriptKey As String = "someScript" If Not Page.ClientScript.IsClientScriptBlockRegistered(displayScriptKey) Then Page.ClientScript.RegisterClientScriptBlock(Me.GetType, displayScriptKey, script) End If Quote slow down when you need to hurry, stop when you need to move on, look back when you need to forget, or you might slip and leave sanity
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.