Click to See Complete Forum and Search --> : scriptmanager updatepanel with jquery


bluetorch
05-18-2010, 08:14 AM
Im pretty new to AJAX.... but i already figured out thats its relatively simple to enable AJAX on you website....

just add a scriptmanager and update panel en contenttemplate.... now this works perfect.....

now i want to add jquery functionality... this works not too good :)

I simply want to add a datapicker to some fields in my webpage, this works , but as soon as there is a postback of a dropdownlist or something else, its broken....


i can give you the code but i simply need a toturial and some advice if this is possible or not to keep having the AJAX scriptmanager AND use the jquery things.... or that you must choose ?


on every page load i have put the function RegisterScripts()
when its not postbacked , and it is postbacked
( why ? the ISstartupregistered should check if the script is already on the page or not in every case so .... )


Protected Sub RegisterScripts()
'Dim bln As Boolean = ClientScript.IsStartupScriptRegistered("datepicker")

If Not (ClientScript.IsStartupScriptRegistered("scr_datepicker")) Then
Dim strScript As String = ""
strScript = "<script type='text/javascript'>"
strScript += "$(document).ready(function() {"
strScript += "$('#" + txtGeboortdatum.ClientID + "').datepicker();"
strScript += "$('#" + txtBeginWerkloosheid.ClientID + "').datepicker();"
strScript += "});"
strScript += "</script>"

ClientScript.RegisterStartupScript(Me.GetType, "scr_datepicker", strScript, False)
End If
End Sub


but this check (ClientScript.IsStartupScriptRegistered) is always false, why ????

i guess it gets broken by inserting it twice....

bluetorch
05-18-2010, 08:28 AM
after like 3 days, i just figured out i have to use the scriptmanager to add the script ( DUH ?! ) but nowhere on the net i have noticed this....

so instead of using clientscript.register.....

i need to use Scriptmanager.Register


(cursing very very loud ...... )