Dynamic LinkButton not working in ASP.NET

Discussion in 'Software' started by tapasmahata, Mar 14, 2008.

  1. tapasmahata

    tapasmahata

    Joined:
    Jan 12, 2008
    Messages:
    7
    Location:
    Kolkata
    Hi,

    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.

    Thanks



    Tapas
    tapasmahata, Mar 14, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c2FuanU=?=

    information about asp ,oracle,asp.net certification?

    =?Utf-8?B?c2FuanU=?=, May 18, 2005, in forum: Microsoft Certification
    Replies:
    1
    Views:
    498
    Bob Christian
    May 18, 2005
  2. paulnf

    ASP.net 2.0 C# dynamic query

    paulnf, Oct 3, 2006, in forum: Software
    Replies:
    0
    Views:
    1,137
    paulnf
    Oct 3, 2006
  3. tmpm7
    Replies:
    0
    Views:
    1,137
    tmpm7
    Feb 18, 2008
  4. london1919
    Replies:
    1
    Views:
    2,876
    Lawrence Garvin \(MVP\)
    Dec 8, 2008
  5. IvanTsoi

    Problem in using linkbutton in asp.net2.0

    IvanTsoi, Jul 27, 2011, in forum: General Computer Support
    Replies:
    0
    Views:
    1,034
    IvanTsoi
    Jul 27, 2011
Loading...

Share This Page