How to create dynamically LinkButton with Literal Control in ASP.NET
Posted
by
SAMIR BHOGAYTA
on Samir ASP.NET with C# Technology
See other posts from Samir ASP.NET with C# Technology
or by SAMIR BHOGAYTA
Published on 2010-03-12T01:09:00.000-08:00
Indexed on
2010/12/06
17:00 UTC
Read the original article
Hit count: 387
How to create dynamically
asp:UpdatePanel id="up1" runat="server">
contenttemplate>
asp:Literal ID="lt1" Text="" runat="server">
asp:PlaceHolder ID="ph1" runat="server">
/asp:PlaceHolder>
/contenttemplate>
/asp:UpdatePanel>
Step 2 :
string query = query for fill the dataset;
DataSet ds = new DataSet();
ds = pass the query to retrive data;
int i = 0;
LinkButton lt = new LinkButton();
for (i = 0; i < ds.Tables[0].Rows.Count; i++)
{
lt = new LinkButton();
lt.ID = "link" + i.ToString();
lt.Text = ds.Tables[0].Rows[i].ItemArray[1].ToString();
ph1.Controls.Add(lt);
ph1.Controls.Add(new LiteralControl("
"));
}
© Samir ASP.NET with C# Technology or respective owner