I am using a panel there is a div inside this panel . I need to set the height and width , css style for this div . But i am not able to find this div id in the c# code . How can i get this div id in c# , and add style to this div . Any answer would be appreciated
Add runat="server"
attribute into div along with its ID.
You can set CssClass
in that div ID
in following way"
DivID.CssClass = "className";
使该DIV runat="server"
并为其提供ID
,然后使用它。
Div1.Style.Add("color","red"); // or any other style attribute in place of color
如果您的div确实具有runat="server"
则可以获取对面板的引用,然后使用:
var div = panel.FindControl("divId");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.