calling jquery function in .cs file [Resolved]

Posted by Klbaiju under jQuery on 6/20/2016 | Points: 10 | Views : 523 | Status : [Member] | Replies : 1
Hi,

i want to call 2 jquery function in .cs file like below on pageload event

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "tripbind();", true);
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "busbind();", true);

problem is only the fistcommand will work.here only tripbind function will work

and busbind will not work.

if i change the order then busbind will only work

i want to fire both commands .


How to solve this


Regards

Baiju




Responses

Posted by: Rajnilari2015 on: 6/20/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
We can have multiple JQuery statements in once in RegisterStartupScript as under

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "tripbind();busbind();", true);


Another way is to provide unique name to each script block like

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script1", "tripbind();", true);


ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script2", "busbind();", true);

That should also work


Hope that helps

--
Thanks & Regards,
RNA Team

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response