Click here to Skip to main content
15,905,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to show multiple records in div. so i want each row will be shown in a new div,
how to generate new div on each record.
please help me

thanks in advance
Posted
Comments
Shobhana.n 5-Sep-13 8:41am    
Why you are not using javascript or jquery???

put a Panel in your page and then you can generate each tag you need like below and add it to Panel :
C#
System.Web.UI.HtmlControls.HtmlGenericControl divName = new HtmlGenericControl("div");

Panel1.Controls.Add(divName);

hope it helps you :)
 
Share this answer
 
Comments
Mohd Arif Khan 5-Sep-13 5:38am    
Thanks sir
this will help you...........

C#
<pre lang="text">
protected void btnCode_Click(object sender, EventArgs e)
{
    System.Web.UI.HtmlControls.HtmlGenericControl dynDiv =
        new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
    dynDiv.ID = "dynDivCode";
    dynDiv.Style.Add(HtmlTextWriterStyle.BackgroundColor, "Gray");
    dynDiv.Style.Add(HtmlTextWriterStyle.Height, "20px");
    dynDiv.Style.Add(HtmlTextWriterStyle.Width, "300px");
    dynDiv.InnerHtml = "I was created using Code Behind";
    this.Controls.Add(dynDiv);
}

 
Share this answer
 
C#
this.Controls.Add(new HtmlGenericControl("Div"))



hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900