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

linkbutton

Programmatically add linkbutton to gridview in asp.net with c#.net

dilake
Light Poster
27 posts since Jan 2008
Reputation Points: 10
Solved Threads: 1
 

Check this code snippet

int rowIndex;
        for(rowIndex = 0; rowIndex < myGrdView.Rows.Count; rowIndex++)
        {
            LinkButton ObjlnkBtn = new LinkButton();
            ObjlnkBtn.Text = "Click";
            //Let myGrdView.Rows[i].Cells[0].Text contains the item ID
            ObjlnkBtn.PostBackUrl = "EditPage.aspx?ID=" + myGrdView.Rows[i].Cells[0].Text;
            //Add Link button to the fifth column of each row in the GridView
            myGrdView.Rows[i].Cells[5].Controls.Add(ObjlnkBtn);
        }
Aneesh_Argent
Junior Poster
104 posts since Dec 2008
Reputation Points: 16
Solved Threads: 18
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You