Integrate variable data with div tag in asp.net

Posted by Srikanth Mattihalli on Stack Overflow See other posts from Stack Overflow or by Srikanth Mattihalli
Published on 2010-05-13T14:07:43Z Indexed on 2010/05/13 14:14 UTC
Read the original article Hit count: 216

Filed under:
|
|
|

Hi all,

I have this code:

I need to replace 800px and 300px from database value; I tried both of the below. But still i am not getting the answer.

Method 1:


<div id="container" style="width:'<% Response.Write(width);%>'px; height:'<% Response.Write(height);%>'px; margin: 0 auto;overflow:hidden;"></div>

Method 2:


<div id="container" style="width:'<%# Eval("width");%>'px; height: <%# Eval("height");%>'px; margin: 0 auto;overflow:hidden;"></div>

The value of height and width variables are defined in page_load() function


int height=300; int width= 800;


This is not affecting the resulting web page. Can anyone help me on this.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET