Is there any way, if it is possible to dynamically generate the ASP.net page from code-behind.
Example:
ASP.net:
<div class="hidOverflow setFloatL smallPadLeft" style="width: 45%" runat="server" id="dvLeft">
</div>
<div class="hidOverflow setFloatL smallPadLeft" style="width: 45%" runat="server" id="dvRight">
</div>
Code-behind:
using (SqlConnection conn = new SqlConnection(gloString))
{
try
{
strQuery = @"";
SqlDataAdapter da = new SqlDataAdapter(strQuery, conn);
DataSet myDataSet = new DataSet();
da.Fill(myDataSet);
//dynamically generate label with the SQL column name as the Text
//dynamically generate label with the SQL column value as the text
//<div class="hidOverflow smallPad">
//<div class="setFloatL halfWidth vertAlignT">
//<span class="profileLabel">{SQL COLUMN NAME}</span>
//</div>
//<div class="setFloatL vertAlignT">
//<asp:Label ID="lbl1" ClientIDMode="Static" runat="server" Text="{SQL COLUMN VALUE}"></asp:Label>
//</div>
//</div>
//.. more .. stop at the 1/2 mark of the count for the dataset and add it to the "dvLeft" div
// STOP...
//dynamically generate label with the SQL column name as the Text
//dynamically generate label with the SQL column value as the text
//<div class="hidOverflow smallPad">
//<div class="setFloatL halfWidth vertAlignT">
//<span class="profileLabel">{SQL COLUMN NAME}</span>
//</div>
//<div class="setFloatL vertAlignT">
//<asp:Label ID="lbl1" ClientIDMode="Static" runat="server" Text="{SQL COLUMN VALUE}"></asp:Label>
//</div>
//</div>
//.. more .. continue from the 1/2 mark of the count for the dataset and add it to the "dvRight" div
}
catch (SqlException)
{
}
}
I am looking to make it dynamic so all I have to do is change the SQL query and the labels will be generated accordingly.
I can most likely use a asp:Repeater
control to achieve it?