how to get linkbutton id that is genrated dynamically from code behind in the eventhandler
        Posted  
        
            by Ranjana
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Ranjana
        
        
        
        Published on 2010-04-27T09:54:26Z
        Indexed on 
            2010/04/27
            10:03 UTC
        
        
        Read the original article
        Hit count: 472
        
i have create two linkbuttons dynamically:
            for (int i = 0; i < 2; i++)
            {
               LinkButton lb = new LinkButton();
                lb.ID = "lnk" + FileName;
                lb.Text = FileName;
                Session["file"] = FileName;
                lb.CommandArgument = FileName;
                lb.Click += new EventHandler(Lb_Click);
                Panel1.Controls.Add(lb);
                Panel1.Controls.Add(new LiteralControl("<br />"));
            }
i have got two links namely:
- File11
 - File22
 
void Lb_Click(object sender, EventArgs e) {
string id=lb.ID;
i.e //--Here how to get link button id which is clicked (either File11 id or File22 id)--------------------
}
© Stack Overflow or respective owner