943,865 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 2679
  • ASP.NET RSS
Jan 3rd, 2008
0

Item Template

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
amith003 is offline Offline
8 posts
since Jan 2008
Jan 4th, 2008
0

Re: Item Template

hi,
use item created or item databound event to write the code u need for checkbox
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007
Jan 4th, 2008
0

Re: Item Template

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[i].findcontrol("CheckboxName");
if(chk.Checked)
{
"Pick the value of that row...."
}
}
Reputation Points: 10
Solved Threads: 2
Light Poster
btech_Saurabh is offline Offline
39 posts
since Jan 2008
Jan 4th, 2008
0

Re: Item Template

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[i].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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
amith003 is offline Offline
8 posts
since Jan 2008
Jan 7th, 2008
0

Re: Item Template

int32 i=e.RowIndex(); // worked in RowDataBound event
Reputation Points: 10
Solved Threads: 2
Light Poster
btech_Saurabh is offline Offline
39 posts
since Jan 2008
Jan 15th, 2008
0

Re: Item Template

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.
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Printing on client using a web application, written in vb.net
Next Thread in ASP.NET Forum Timeline: need some help retrieving a record count data





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC