|
-
Jul 21st, 2005, 01:58 AM
#1
Thread Starter
Addicted Member
client side script
Hi,
can anyone show me how to handle client side script with asp.net? make sense? how will client side script communicate with code behind?
Thanks,
Jewel
-
Jul 21st, 2005, 02:30 AM
#2
Re: client side script
You can use two methods: Page.RegisterStartupScript to make some js run immediately, or Page.RegisterClientScriptBlock to add some javascript to your page. You generate the javascript in the codebehind with your controls, or whatever logic you want.
-
Jul 21st, 2005, 02:50 AM
#3
Thread Starter
Addicted Member
Re: client side script
hi, thanks...can you give me an example please...
-
Jul 21st, 2005, 03:58 AM
#4
Re: client side script
Example:
VB Code:
Dim strJS As String
strJS = "<script language=JavaScript>function selectAll(intAction){" & _
"if(intAction==0)" & _
"{"
For i As Integer = 0 To strArrayA.GetUpperBound(0)
strJS &= "document.getElementById('" & strArrayA(i).ToString() & "').checked = true;"
Next
strJS &= "}" & _
"else" & _
"{"
For j As Integer = 0 To strArrayD.GetUpperBound(0)
strJS &= "document.getElementById('" & strArrayD(j).ToString() & "').checked = true;"
Next
strJS &= "}}</script>"
Page.RegisterClientScriptBlock("theselectallfunction", strJS)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|