|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataGrid & Checkbox Template ColumnsHi,
I've got a simple datagrid in asp.net (C#) that is populated by an adapter from SQL. I have two template columns - one with a checkbox and one with a textbox. I am allowing users to indicate which rows to remove from the grid by checking the boxes - the boxes don't autopostback, i want to remove all selected rows at once on page postback - my problem is: I can find now way of iterating through the datagrid rows to check whether each checkbox in the template column is checked or not!! Does anyone know of a way to do this? If you wire the onCheckedChanged event of the CheckBox server control to a
method then when you postback using any other button the event will be processed for each row that is checked, e.g. <asp:CheckBox ID="chkDelete" title="click here to delete this row" Runat=server OnCheckedChanged ="DeleteRow"></asp:CheckBox> For a complete sample code: http://www.societopia.net/Samples/DataGrid_ChildControlsEvents.aspx Show quoteHide quote "JP" wrote: > Hi, > I've got a simple datagrid in asp.net (C#) that is populated by an > adapter from SQL. I > have two template columns - one with a checkbox and one with a textbox. > I am allowing users to indicate which rows to remove from the grid by > checking the boxes - the boxes don't autopostback, i want to remove all > selected rows at once on page postback - my problem is: > > I can find now way of iterating through the datagrid rows to check > whether each checkbox in the template column is checked or not!! Does > anyone know of a way to do this? > >
radiobuttonlist.selectedIndex always -1.........
How to read value of a dynamically created radiobuttonlist control? Postback problem with web parts What's the 'preferred' way to divide a Web page into sections? Login control and validation Trying to set stored procedure parameter for sqldatasource in formview (edit mode) asp.net control to run in web page like just COM refresh gridview asp:Repeater + no viewstate + DataBind() ?? Where are the events of the aspx? |
|||||||||||||||||||||||