Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > Dynamic LinkButton not working in ASP.NET

Thread Tools

Dynamic LinkButton not working in ASP.NET

tapasmahata tapasmahata is offline
Junior Member
Join Date: Jan 2008
Location: Kolkata
Posts: 7

Scenario: I am using some dynamic LinkButton to perform some work. At the time of Page Load I am creating those LinkButton and placing them in the Placeholder. Now I want to show details whenever user click on it. It works fine for general text but when there is single quoted text the link not working. I can replace that single quote with some other character but I don't want this. I think it will be possible using the parameterized query but I don't need to run query everytime I click on the links. So I store my database values in a DataSet with some Session variable and afterwards I am retrieving data according to my LinkButton clicks from that DataSet to reduce time consumption.

Now look at my Code:

private void nlbtn_Click(object sender, CommandEventArgs e)

DataSet ds = (DataSet)Session["AllValues"]; // This is the DataSet which store all my data // Here I am trying to retrieve information from the DataSet according to my LinkButton Clicks.

DataRow []dr= ds.Tables[0].Select("linktext='"+e.CommandArgument+"'"); // Here linktext is one of the column name of my database and e.CommandArgument have the value of the clicked LinkButton

this.lblHeading.Text = e.CommandArgumentToString();
this.lblQuote.Text = dr[0]["Quote"].ToString();

this.lblPara1.Text = dr[0]["Para1"].ToString();
this.lblPara2.Text = dr[0]["Para2"].ToString();

this.Image1.ImageUrl = "~/Dyna_images/" + imagepath;


Please make changes to solve my problem. It's very urgent for me.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic LinkButton not firing it's events. Mufasa ASP .Net 3 06-15-2009 09:57 AM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net 3 09-08-2005 09:41 AM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net Datagrid Control 1 09-08-2005 08:44 AM
Adding dynamic LinkButton to dynamic table =?Utf-8?B?QkxpVFpXaU5H?= ASP .Net 0 07-27-2005 12:21 AM
RE: linkbutton event not working (Resolved but still have a question) =?Utf-8?B?YW5kcmV3IFdpZWQ=?= ASP .Net 1 04-27-2004 04:01 AM