FAQ Database Discussion Community


Trigger a js function with parameter from code behind

c#,jquery,asp.net,scriptmanager,registerstartupscript
C# Trigger a js function with parameter from code behind. I have the following code: C#: ScriptManager.RegisterStartupScript(this, this.GetType(), "ScriptManager1", String.Format(@"ShowHideMessageBlock('{0}')", @"#successMsg"), true); js: function ShowHideMessageBlock(xid) { var c = xid; console.log(c); $(c).fadeIn('slow', function () { $(this).delay(5000).fadeOut('slow'); }); } When I open the console window I get the following message: Uncaught...

What does a ScriptManager script reference do?

javascript,asp.net,webforms,scriptmanager
On a previous project that I was working on, I noticed that the javascript files were included inside the script manager like so: <asp:ScriptReference Path="~/Scripts/jquery-1.7.1.min.js" /> <asp:ScriptReference Path="~/Scripts/site.js" /> I've tried searching as to what the difference between a script reference and a regular <script src="/> is in an asp...

Return value of ScriptManager.RegisterStartupScript confirm box in code behind

asp.net,gridview,imagebutton,scriptmanager,confirm
There are two confirm boxes on an ImageButton - first one is regular one saying "Are you sure you want to delete it?" (that is from the OnClientClick event on Client side ). If 'Yes' is selected, then it goes into the server side code, where another check happens and...

RequiredFieldValidator not correct working when i use ScriptManager.RegisterStartupScript

asp.net,scriptmanager,requiredfieldvalidator
When I fired btn event. after refresh page and RegisterStartupScript my asp.net validators not working corectly protected void btnSumbit_Click(object sender, EventArgs e) { NotifyShow("example"); } public void NotifyShow(string msg) { string myScript = string.Format("ShowMessages('{0}','{1}');", msg, "type"); StringBuilder str = new StringBuilder(); str.Append(myScript); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "AlertJS", str.ToString(), true); } this HTML...