Click here to Skip to main content
16,019,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

I bonded Labels And Link Button Dynamically In Tables .. Link buttons Appears in front Of labels.. i Want To carry Text of that Label through Query String.. I used following Code.. pls Suggest me Wat to Do?
C#
public void Deladdress()
        {
            DataSet dl = Deliverydetails();

            int count = dl.Tables[0].Rows.Count;
            for (int i = 0; i < count; i++)
            {
                TableRow tr = new TableRow();
                TableCell td0 = new TableCell();
                TableCell td1 = new TableCell();

                Label lb0 = new Label();
                //Label lb1 = new Label();
                LinkButton lbl = new LinkButton();

                addr = dl.Tables[0].Rows[i]["clad_name"].ToString() + ',' + dl.Tables[0].Rows[i]["clad_line_1"].ToString());
                lb0.Text = addr;
                lb0.ID = Convert.ToString((i + "lb0"));
              
                lbl.Text = "UpDate";
                lbl.ID = Convert.ToString((i + "lbl"));
                lbl.Click += new EventHandler(LinkButton2_Click);
                td0.Controls.Add(lb0);
                td1.Controls.Add(lbl);
                tr.Cells.Add(td0);
                tr.Cells.Add(td1);
                Table1.Rows.Add(tr);
            }
        }
            

  
        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            LinkButton btn = (LinkButton)sender;
            string btnid = btn.ID;
           // string[] btnid = btn.ID.Split('l');
           // int addrId = Convert.ToInt32(btnid[0].ToString());
            Response.Redirect("Billi.aspx?id=" + uid + "&action=update&type=billing&addr=" + addr);
        }
Posted
Updated 16-May-12 2:23am
v3

1 solution

Add the label text to the CommandArgument property of the button and retrieve it in the OnCommand event handler.
 
Share this answer
 
v2
Comments
Wendelius 16-May-12 15:49pm    
Sounds like a solution :)
Narasappa From Dharwad 17-May-12 0:50am    
Im not Getting how to add....
[no name] 17-May-12 7:04am    
How to add what?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900