Integrate variable data with div tag in asp.net
- by Srikanth Mattihalli
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.