Q:

Access a div inside ListView in codebehind

I have a div with id="myDiv" and runat="server" inside a listview with id="lvItem".I need to access the div in code behind to add width of the div at runtime.How can I access the div from codebehid using C#?Can anyone help me?

A:

Just add an Asp:Panel instead. Asp:Panel in ASP.NET = DIV on the front end.
So basically this would be your code
ASP.NET
<asp:Panel id="myDiv" runat="server">
</asp:Panel>

Code Behind
Panel myDiv = (Panel)myListView.FindControl("myDiv");
myDiv.Attributes.Add("style", "width: 100px");

