Reputation: 67
i am using update panel and AutoPostback in an asp.net, but after postback my scripts are not loaded properly which are already in the page causing some of the elements that require that script to misbehave i have been told to load the scripts in pageLoad() but i am not sure how to do that. I want to load scripts such as jquery bootstrap and some other plugins just to modify the elements looks, can any one guide me?
Upvotes: 1
Views: 339
Reputation: 6111
Actually, you can use pageOnload event to do so. Like this.
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "show", "<script>document.getElementById('Your element').style.display = 'block'</script>");
}
else
{
this.ClientScript.RegisterStartupScript(this.GetType(), "show", "<script>document.getElementById('Your element').style.display = 'hidden'</script>");
}
}
Upvotes: 1