I have already add dynamic LinkButton in run time under a Search Button event.
The Code is here:
for (int i = 0; i < db.dataSet.Tables["searchResult"].Rows.Count; i++)
{
LinkButton lnkSearch = new LinkButton();
lnkSearch.Text = txtSearch.Text.ToString();
lnkSearch.ID = "label" + i.ToString();
this.UpdatePanel1.ContentTemplateContainer.Controls.Add(lnkSearch);
this.UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("<br/>"));
}
This working good when I am click in a search Button.
The Code is here:
protected void btnSearch_Click(object sender, EventArgs e)
{
Page.Response.Redirect("Search.aspx?SearchKey=" + txtSearch.Text.ToString());
}
So, in my summary I have three pages: 1. Default.aspx and 2. Search.aspx and 3. SearchResult.aspx. The Default.aspx page is my start up project page. Here I have a TextBox and a Button for search. My approach is write string in TextBox then click in the Button then under the event of the Button I run a SQL query to pick up data from database.
Now, suppose I got 3 results as 3 Article's Names and their 3 .pdf links. I can show the 3 Articles Name by adding 3 LinkButton with the LinkButton Text property. But, I am confused how to add 3 PDF link with these LinkButton and when I would click the LinkButton that will open another page named SearchResult.aspx with the specific pdf file in iframe control which is in SearchResult.aspx file as for example if I click LinkButton-1 than I will find in SearchResult.aspx file in iframe control with Pdf-1.
This is my problem. If anybody help me than I will very thankful to you. Please help me. Thank You!