Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Magnus #1
DataGrid with CheckBox - How to read checked rows
I have added a checkbox to a dataset that I bind to a datagrid:
DataColumn colBoolean = new DataColumn ("chkBox");
colBoolean.DataType = System.Type.GetType ("System.Boolean");
colBoolean.DefaultValue = true;
ds.Tables["etikett"].Columns.Add (colBoolean);
grd.DataSource = ds.Tables["etikett"].DefaultView;
grd.DataBind();
How do I read all the rows that have been checked? I want to create a
report (crystal) for only the checked rows.
Regards,
Magnus
Magnus Guest
-
Summarize values when checkbox is checked
Hello all, The output of some query shows for example 10 records with invoice prices. Before each record is an unchecked checkbox. What I like to... -
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the... -
Saving checkbox states (checked or unchecked)?
Hello. I'm creating a basic form with checkboxes for "yes/no". Is there a way for the state of the checkboxes to be saved by the user (using regular... -
Find what checkbox is checked in javascript
I have to sets of checkboxes. The second is to delete the row. So when I click that checkbox I want to add it to an array. I also need to take it... -
Capturing checked event for Template based checkbox.
Getting to grips with the datagrid better than I thought, however I've hit another problem which hopefully someone will be able to help (again.) ... -
Brock Allen #2
Re: DataGrid with CheckBox - How to read checked rows
> How do I read all the rows that have been checked? I want to create a
You'll have to loop over the rows in the DataGrid and access the Cell that> report (crystal) for only the checked rows.
contains the checkbox. Once you have the cell, use FindControl("YourCheckBoxID")
to get the CheckBox control then get its Checked property.
// pseudocode
foreach (DataGridRow row in grid.Rows)
{
Control c = row.Cells[TheIndexOfYourCheckBoxColumn].FindControl("YourCheckBoxID");
CheckBox cb = c as CheckBox;
if (cb != null && cb.Checked)
{
// this row has been selected
}
}
-Brock
DevelopMentor
[url]http://staff.develop.com/ballen[/url]
Brock Allen Guest



Reply With Quote

