troubleshooting Question

Change client-side javascript variable value from server side

Avatar of sandya_116
sandya_116 asked on
ASP.NET
3 Comments2 Solutions308 ViewsLast Modified:
On page load, I have the below code to set the totalcount variable value to 25. On a button click, I would like to change this value to row count of a grid. How do I change this?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim sb As StringBuilder = New StringBuilder()
 sb.Append("<script type=""text/javascript"">")
sb.AppendFormat("var Label1 = '{0}';", "Less")
sb.AppendFormat("var Label2 = '{0}';", "More")
b.AppendFormat("var {0} = '{1}';", "TotalCount", 25)
sb.Append("initPages();")
sb.Append("</script>")
Me.Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "searchscript", sb.ToString())
End Sub

Protected Sub Continue_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Continue.Click

End Sub
ASKER CERTIFIED SOLUTION
Member_6283346

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros