Please help me. So far nobody was able to help. I am trying to assign a dynamically created LinkButton to a string value. I have a function and there is definitely something wrong with it and I need someone to tell me if it can be done or not.

This is what needs to be accomplished: I pull some info from the database, then I search for a specific word and once found I put a LinkButton on that word. The LinkButton is what I am struggling with everything else works fine. I can replace the matched word with some other string but I can't figure out how to assign a LinkButton to the string. PLEASE HELP!!!!!!!!

<cc1:Accordion ID="acc1" runat="server" HeaderCssClass="accordionHeader" ContentCssClass="accordionContent" SuppressHeaderPostbacks="true" FadeTransitions="true" TransitionDuration="250" FramesPerSecond="40" RequireOpenedPane="false">
<HeaderTemplate><%# ((DataRow)Container.DataItem)["Term"] %></HeaderTemplate>
<ContentTemplate><%# DisplayPoem(((DataRow)Container.DataItem)["Definition"].ToString())%></ContentTemplate>

public string DisplayPoem(string Poem)
        LinkButton lb1 = new LinkButton();
        Regex re = new Regex(@"(?<=<term>)(.*?)(?=</term>)", RegexOptions.IgnoreCase);
        Match match = re.Match(Poem);
        lb1.ID = output;
        lb1.Text = match.ToString();
        string output = Regex.Replace(Poem, @"(?<=<term>).*(?=</term>)", match.ToString());
        lb1.Click += new EventHandler(lb1_Click);
        return output;
7 Years
Discussion Span
Last Post by anuj_sharma

how do you want to assign the linkbutton?? I mean which property of the linkbutton you want to set to the word that is found??

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.