soona Posted March 5, 2009 Share Posted March 5, 2009 Hi,I am using asp.net 2.0 with c#.I have one Gridview with 3 rows and 4 columns. In the 1st row no need 5th column. if more than one row.I want to add a button in 2nd row of 5th column but not for 1st row.Is this possible in a gridview?If it is possible pls give some source or reference.Thanks Link to comment Share on other sites More sharing options...
brajbeekay Posted March 13, 2009 Share Posted March 13, 2009 Yes It can be done... Ur question is not clear, however I suppose there are 4 columns and 3 rows in your gridview & U want to add a button in last column of 2nd row... Right?? This can be achieved by using GridView's DataBound Event...protected void GridView1_DataBound(... , ...){ if(GirdView.Rows.Count > 1){ int curRowCount=1; foreach(GridViewRow row in GridView1.Rows){ if(curRowCount == 2) { Button btn=new Button(); btn.Text="My Button";//Adding Button Ctrl in 2nd Row & 4th Column row.Cells[3].Controls.Add(btn); break; } curRowCount++; } } }I hope it will work for U...RegardsBraj Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.