0

Hi all,
I have created a DataGrid and i have included a template field of checkboxes(i.e' a column is created consisring of checkboxes) now i want to know how to get the data from the row in the datagrid where checkbox is selected and assign that data to any variable?

Thanks in Advance
Amith A

4
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by SheSaidImaPregy
0

first u have to create an object of Checkbox
then u have to find that checkbox in ur Datagrid using loop like
checkbox chk;
for(int i=0;i<=datagrid.rows.count-1;i++)
{
chk=(CheckBox)Datagrid1.Items.findcontrol("CheckboxName");
if(chk.Checked)
{
"Pick the value of that row...."
}
}

0

first u have to create an object of Checkbox
then u have to find that checkbox in ur Datagrid using loop like
checkbox chk;
for(int i=0;i<=datagrid.rows.count-1;i++)
{
chk=(CheckBox)Datagrid1.Items.findcontrol("CheckboxName");
if(chk.Checked)
{
"Pick the value of that row...."
}
}

-----------------------------------------------------------------------------

Thanks for your reply, this i hav done can u tell me how to pick the value of the row and put it into some variable?

0

That or if you wish to set your own value, you can set an attribute on your checkbox with any value you wish. Then when a checkbox is clicked, you pull it's value. Might work better than rowIndex depending on what you're doing on your application.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.