sql - Add GridView Button Dynamically -
i have asp.net form button1 , gridview1. when click button1, performs "select * table" query , dumps output gridview1.
//update gridview1 gridview1.datasource = _datatable; gridview1.databind();
i have set autogeneratecolums property ti true work.
but want each row in gridview, want create new column called "click" contains button each row.
//refetch data datacolumn dc = new datacolumn("click", typeof(buttonfield)); _datatable.columns.add(dc); buttonfield _buttonfield = new buttonfield(); _buttonfield.buttontype = buttontype.button; _buttonfield.text = "testing"; _datatable.rows[0].setfield("click", _buttonfield); //update gridview gridview1.datasource = _datatable; gridview1.databind();
its not working. help
change code this. add button on gridview. can handle click event , write select code.
buttonfield buttonfield = new buttonfield { buttontype = buttontype.button, text = "testing" }; gridview1.columns.add(buttonfield); gridview1.datasource = _datatable; gridview1.databind();
Comments
Post a Comment