I am Working in asp.net and c#. I have a div
tag in my application with class="something"
.I need to access this something class in codebehind.How can i do that..
Code:
<div class="something">
//somecode
<div>
Note:I want access Something class in codebehind.
Give ID
and attribute runat='server'
as :
<div class="something" ID="mydiv" runat="server">
//somecode
<div>
Codebehind:
You can modify your something
styles here.
mydiv.Style.Add("display", "none");
Make it a server tag if you want to access it in CS code.
<div class="something" runat="server" id="something">
//somecode
<div>
asp.net does not provide a method to search by classes. so you will have to rely on the ID.
CS:
something.InnerHtml = "some code";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With