Reputation: 1124
i wants to generate an chart like given in image in html dynamically from code behind in asp.net.
their would be an unique serial number at the top left of each block which would be unique & total 1000 in 10 charts.
thats why hardcoding 1000 blocks would be much difficult although i have tried.
<DIV STYLE="position:absolute; top:9px; left:12px; width:200px; height:25px">
<IMG SRC="bricks.png" width="250px" height="45" >
<DIV STYLE="position:absolute; top:0px; left:5px; width:200px; height:25px">
<FONT SIZE="+0" COLOR="00ff00">0001</FONT>
</DIV>
</DIV>
<DIV STYLE="position:absolute; top:9px; left:270px; width:200px; height:25px">
<IMG SRC="bricks.png" height="45" width="150px">
<DIV STYLE="position:absolute; top:0px; left:5px; width:200px; height:25px">
<FONT SIZE="+0" COLOR="00ff00">0002</FONT>
</DIV>
</DIV>
<br>
<DIV STYLE="position:absolute; top:9px; left:12px; width:200px; height:75px">
<IMG SRC="bricks.png" height="45" width="150px">
<DIV STYLE="position:absolute; top:50px; left:5px; width:200px; height:25px">
<FONT SIZE="+0" COLOR="00ff00">0003</FONT>
</DIV>
</DIV>
and also:
<IMG SRC="bricks.png" height="45" width="150px">
<DIV STYLE="position:absolute; top:9px; left:270px; width:200px; height:25px">
<FONT SIZE="+0" COLOR="00ff00">0002</FONT>
</DIV>
Upvotes: 0
Views: 397
Reputation: 387
You really take a look at the Literal control, this can be used to write out an HTML. The Literal control will get substituted at run time. Asp Literal Found this also on MSDN Literal Controls Explained
Upvotes: 1
Reputation: 4864
If you are much familiar with HTML there are much options in front of you.
ASPX Page
<form id="demo" runat="server">
<%=DrawHtml() %>
</form>
.CS Page
public string DrawHtml()
{
string Content="";
for(int i=0;i<10;i++)
{
Content+="Hello</br>";
}
return Content;
}
Alternatively If you are Following Dynamic Html rendering using placeholder,
use HtmlGenericControl
Class instead.
You will get better tutorial from here and here
Upvotes: 3
Reputation: 24515
I would suggest going through some tutorials on www.asp.net to get familiar with asp and ow html is rendered to the page.
Here is a basic example that uses a foreach loop, which you can use to render your page when you have to repeat html rendering.
http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx
Upvotes: 1