asp.netcssvb.nethtml

Changing a CSS style from ASP.NET codebehind


I need to change the height of a div container (the CSS height property) from ASP.NET code (VB).

How can I do that?


Solution

  • C#, because I don't want to typo the VB syntax.

    Markup:

    <div runat="server" id="divControl">...</div>
    

    Class of the Page:

    protected System.Web.UI.HtmlControls.HtmlGenericControl divControl;
    

    OnLoad/Other function:

    divControl.Style.Add("height", number / anotherNumer);