Home
> Asp.net, JavaScript, JQuery > How to register a startup (document).ready(..) script only for the first page load
How to register a startup (document).ready(..) script only for the first page load
Snippet
public partial class Test : Page { private string script = @" $(document).ready(function () { }); "; protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (!this.Page.IsPostBack) this.Page.ClientScript.RegisterStartupScript(this.GetType(), this.GetType().Name, this.script, true); } }
Categories: Asp.net, JavaScript, JQuery
Asp.net, Javascripts, JQuery
Comments (0)
Trackbacks (0)
Leave a comment
Trackback