Remove css from div on server side C# -
i have div tag has inline css visibility hidden
<div id="secondgrid" runat="server" style="width:80%; margin-left:10%; visibility:hidden;"> //content </div>
i have button in gridview, on click of want remove visibility css of above div
protected void gridview1_rowcommand(object sender, gridviewcommandeventargs e) { if (e.commandname == "showcarmodels") { carbrandid = convert.toint32(e.commandargument.tostring()); bindgridview2(carbrandid); secondgrid.style.remove("visibility"); } }
the div still appear hidden. can please me out.
you should use visible
property. use html control @ server side can use visible property show or hide control.
secondgrid.visible = true;
for above solution need change html markup follwing
<div id="secondgrid" runat="server" visible="false" style="width:80%; margin-left:10%;"> //content </div>
but if want continue markup can remove style using htmltextwriterstyle
secondgrid.style.remove(htmltextwriterstyle.visibility);
Comments
Post a Comment