Question : SQL Dataset in to divs with class names

Hi,

I have a c# code behind solution, I have data coming in from a database with two paired values, I would like to take these values and add them to the front page within separate divs with class names as the first value:

 
1:
2:
3:
4:
5:
6:
<div id='datacollection'>
    <div class='3354'>content text</div>
    <div class='3354'>content text2</div>
    <div class='3353'>content text4</div>
    <div class='3359'>content text9</div>
</div>


This is a snippet of the generic code I will be using to fill the html above:
 
1:
2:
3:
4:
5:
6:
7:
DataSet ds = dbA.getDataSet ();
Dictionary<string, string> LayerArrayList = new Dictionary<string, string> ();
foreach (DataRow dRow in ds.Tables[0].Rows) {
    // add DataRow object to ArrayList
    LayerArrayList.Add ((string)dRow[0], (string)dRow[1]);
}
return LayerArrayList;


How can this be done?

Darren

Answer : SQL Dataset in to divs with class names

You are better off using a repeater control for this:

http://www.beansoftware.com/ASP.NET-Tutorials/Repeater-Control.aspx

Based on the article above, your repeater could look something like this. All you  need to do is to replace the 'className' and 'contentText' fields with the actual column names.

Arun
1:
2:
3:
4:
5:
6:
<asp:Repeater ID="Repeater1"  runat="server" DataSourceID="SqlDataSource1">
     <ItemTemplate>
           <div class='<%#DataBinder.Eval(Container.DataItem, "className")%>'><%#DataBinder.Eval(Container.DataItem, "contentText")%>
         </div>
     </ItemTemplate>
</asp:Repeater>
Random Solutions  
 
programming4us programming4us