954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

HELP -- assign a dynamically created LinkButton to a string value

Hello,

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>
   </cc1:Accordion>


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;
        
    }
lm111
Newbie Poster
19 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

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??

anuj_sharma
Posting Whiz in Training
208 posts since Jul 2008
Reputation Points: 8
Solved Threads: 13
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You