List Info

Thread: Gridview with checkboxes




Gridview with checkboxes
country flaguser name
United States
2007-07-16 23:08:24
Vb.net

ASP.Net 2.0

 

I need to build a dynamic page that lists line detail data
with a
checkbox for each row.  Then when the page is submitted I
need to go
through the items that are selected and process them.  This
seems like a
simple task and have done this with classic ASP a few times,
but I'm at
a loss on how to do it with ASP.NET.

 

Should I use a dataview?  I can't figure out how to create
a
checkboxfield that is NOT bound to a data field.  I don't
really have a
data field to bind to, this is a simple question (checkbox)
I need the
user to click to select the line item to be processed.

 

You see this functionality all over the web (web email
clients, shopping
carts, etc...).  Can anyone point me in the right direction
with some
simple samples I can build from?

 

Thanks

Slade Hornick
Systems Administrator
Texas Farm Bureau 
Office: 254 751 2663
Mobile: 254 744 3853

 

 




--- List Settings ---
http://aspadvice.com/list
s/


Re: Gridview with checkboxes
user name
2007-07-17 08:50:33
Slade,
 
Here is a pretty clear example using a datagrid.  Let us know if you need further help or show us some code.
 
 
HTH,
 
Ronda
 


 
On 7/16/07, Slade Hornick < shornicktxfb.org">shornicktxfb.org&gt; wrote:
Vb.net

ASP.Net 2.0



I need to build a dynamic page that lists line detail data with a
checkbox for each row.  Then when the page is submitted I need to go
through the items that are selected and process them. ; This seems like a
simple task and have done this with classic ASP a few times, but I'm at
a loss on how to do it with ASP.NET.



Should I use a dataview?&nbsp; I can't figure out how to create a
checkboxfield that is NOT bound to a data field.&nbsp; I don't really have a
data field to bind to, this is a simple question (checkbox) I need the
user to click to select the line item to be processed.



You see this functionality all over the web (web email clients, shopping
carts, etc...).&nbsp; Can anyone point me in the right direction with some
simple samples I can build from?



Thanks

Slade Hornick
Systems Administrator
Texas Farm Bureau
Office: 254 751 2663
Mobile: 254 744 3853








--- List Settings ---
http://aspadvice.com/lists/




--
Ronda Pederson --- List Settings --- http://aspadvice.com/lists/
RE: Gridview with checkboxes
country flaguser name
United States
2007-07-19 23:32:35
Hi,
This is very simple program.
You have to take one template item to add check in
datagrid.
You don't need to bind with database item.
For each row you will get a checkbox.

When you use the checkbox for selecting particular row 
Or performing any operation on that row.
All you to do is create an object of that checkbox.
Eg. Checkbox chk1 = new Checkbox
And getting the selected id you have to capture that
selected index.
Eg. Chk1 = (Checkbox).Datagrid.rows[e.Rowindex].column[1]

Then may access that row like

For (int i=0;i<Datagrid.rows.count-1;i++)
{
  if (Chk1[i].checked = true) 
  {
	///your desired code here for on selected row
  }
}


Hope you will find this chunk of code useful...
And still your problem doesn't sort out you can write me.
Bye

Regards
Sanjay Malvi
Software Engginner
(India)





-----Original Message-----
From: Slade Hornick [mailto:shornicktxfb.org] 
Sent: Tuesday, July 17, 2007 9:38 AM
To: aspnetaspadvice.com
Subject: [aspnet] Gridview with checkboxes

Vb.net

ASP.Net 2.0

 

I need to build a dynamic page that lists line detail data
with a
checkbox for each row.  Then when the page is submitted I
need to go
through the items that are selected and process them.  This
seems like a
simple task and have done this with classic ASP a few times,
but I'm at
a loss on how to do it with ASP.NET.

 

Should I use a dataview?  I can't figure out how to create
a
checkboxfield that is NOT bound to a data field.  I don't
really have a
data field to bind to, this is a simple question (checkbox)
I need the
user to click to select the line item to be processed.

 

You see this functionality all over the web (web email
clients, shopping
carts, etc...).  Can anyone point me in the right direction
with some
simple samples I can build from?

 

Thanks

Slade Hornick
Systems Administrator
Texas Farm Bureau 
Office: 254 751 2663
Mobile: 254 744 3853

 

 




--- List Settings ---
http://aspadvice.com/list
s/

This e-mail and any files transmitted with it are for the
sole use of the intended recipient(s) and may contain
confidential and privileged information.
If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies of the
original message. 
Any unauthorised review, use, disclosure, dissemination,
forwarding, printing or copying of this email or any action
taken in reliance on this e-mail is strictly 
prohibited and may be unlawful.

Visit us at <a href="http://www.fibre2fashion.com">www.f
ibre2fashion.com</a>


--- List Settings ---
http://aspadvice.com/list
s/


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )