private string getjQueryCode(string jsCodetoRun)
{
StringBuilder stringb = new StringBuilder();
stringb.AppendLine(" function pageLoad() {");
stringb.AppendLine(jqCodetoRun);
stringb.AppendLine(" };");
return stringb.ToString();
}
private void runjQueryCode(string jsCodetoRun)
{
ScriptManager requestS = ScriptManager.GetCurrent(Page);
if (requestS != null && requestS.IsInAsyncPostBack)
{
ScriptManager.RegisterStartupScript(this, typeof(Page),
Guid.NewGuid().ToString(), getjQueryCode(jsCodetoRun), true);
}
else
{
Page.ClientScript.RegisterStartupScript(typeof(Page),
Guid.NewGuid().ToString(), getjQueryCode(jsCodetoRun), true);
}
}
from the coding you understand how scripts are regsitered.then
to run any jquery functions you will call above methods as follows-
runjQueryCode("$(function () {$('.slider_callout').val('" + tempo / 10 + "');
var bvalue = $('.bavalue').val();........ });");
you can run any jquery codes above
If you have questions about this post or any topics, post your questions in
discussions/forum in this website, you will get your answer