0

i wants to generate an chart like given in image in html dynamically from code behind in asp.net.

enter image description here

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>
syed Ahsan Jaffri
  • 1,160
  • 2
  • 14
  • 34
  • What is the purpose? Do you want to generate this type of HTML dynamically on client side? Or it is for one time development purpose? – Nisarg Shah Aug 19 '13 at 07:33
  • i have 10 tabs each tab would have 1 chart where sold blocks would be highlighted based on given year. means charts in 10 tabs would be generated on first time at page initialization & after that when ever year value would be change in combobox. – syed Ahsan Jaffri Aug 19 '13 at 19:02

3 Answers3

3

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

Community
  • 1
  • 1
Subin Jacob
  • 4,692
  • 10
  • 37
  • 69
1

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

Mark Redman
  • 24,079
  • 20
  • 92
  • 147
1

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

lloydom
  • 377
  • 2
  • 11