Sandy
Sandy

Reputation: 2449

How to disable a div code behind in C#?

I have a div which I call from code behind via Page.ClientScript.RegisterStartupScript Another div is inside this div with style="display: none; Is it possible to enable the second div when I call the main div in code behind?

This is my code- Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenNewWindow", "<script type='text/javascript'>$(function() { $('#MainDiv').dialog('open'); })</script>");

Upvotes: 3

Views: 3757

Answers (2)

Sandy
Sandy

Reputation: 2449

I called the class name of second div like this-

Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenNewWindow", "<script type='text/javascript'>$(function() { $('#MainDiv').dialog('open'); });$('.second-div-class').show();</script>");

Upvotes: 0

sidhewsar
sidhewsar

Reputation: 135

put these attributes in div runat="server"  and an id="a_name"
Declare Your div like following

<div runat="server" id="dv">
your contents
</div>

call the dv from Code behind and then do with that dv whatever you want 

Upvotes: 1

Related Questions