Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing CSS style from ASP.NET code [duplicate]

Tags:

Possible Duplicate:
Change CSS Dynamically

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

How can I do that?

like image 521
David Bonnici Avatar asked Dec 31 '08 14:12

David Bonnici


2 Answers

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); 
like image 115
Tom Ritter Avatar answered Sep 30 '22 05:09

Tom Ritter


VB Version:

Class:

Protected divControl As System.Web.UI.HtmlControls.HtmlGenericControl 

OnLoad/Other function:

divControl.Style("height") = "200px" 

I've never tried the Add method with the styles. What if the height already exists on the DIV?

like image 23
Lurker Indeed Avatar answered Sep 30 '22 07:09

Lurker Indeed