Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Checkbox functionality

Reply
Thread Tools

Checkbox functionality

 
 
=?Utf-8?B?QnJldA==?=
Guest
Posts: n/a
 
      12-26-2006
I am a VB Developer w/ SQL Server experience breaking into web world via the
Visual Web Developer Express. I've already set up my data sources to my SQL
Server tables and have created a grid view of my tables which executes
successfully. Two of the fields in the gridview are checkboxes that are
bound to a table, datatype is "bit". These 2 fields are "APPROVED" or
"DENIED", in other words, the user needs to check approve or deny a record.
My question is what is the right or best way to accomplish this task,
gridview doesn't seem to accomplish this the way I'd like. Since a user can
potentially have 100 records to approve, I dont want them to have to EDIT
each record one by one and then UPDATE, I just want them to be able to click
each checkbox.
Please help.

thank you.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFuaXNoIEJhZm5h?=
Guest
Posts: n/a
 
      12-27-2006
Hi,
I think ListView Control is more appropriate in your case.You will be able
to implement your functionality easily with ListView Control.
The ListView property CheckedIndices will give you a collection of integers
representing the indexes of all the checked items in the ListView.

ListView.CheckedIndexCollection checkedItems =
listView1.CheckedIndices;

while (checkedItems.Count > 0)
{
//your logic/code comes here
}

Also for selecting/Unselecting all items in ListView Control you just need
to provide one CheckBox above ListView Control and you can then run a loop in
its click event.
Although i have written chkSelectAllPMs_Click function in VB, you can easily
write same cose in C# or VB.NET with little modification.

Private Sub chkSelectAllPMs_Click()
If chkSelectAllPMs.Value Then
For i = 1 To ListView1.ListItems.Count
ListView1.ListItems(i).Checked = True
Next i
Else
For i = 1 To ListView1.ListItems.Count
ListView1.ListItems(i).Checked = False
Next i
End If
End Sub

You can search more about ListView Control in any search engine.
Hope this much helps you out.

Thanks and Regards,
Manish Bafna.
MCP and MCTS.
"Bret" wrote:

> I am a VB Developer w/ SQL Server experience breaking into web world via the
> Visual Web Developer Express. I've already set up my data sources to my SQL
> Server tables and have created a grid view of my tables which executes
> successfully. Two of the fields in the gridview are checkboxes that are
> bound to a table, datatype is "bit". These 2 fields are "APPROVED" or
> "DENIED", in other words, the user needs to check approve or deny a record.
> My question is what is the right or best way to accomplish this task,
> gridview doesn't seem to accomplish this the way I'd like. Since a user can
> potentially have 100 records to approve, I dont want them to have to EDIT
> each record one by one and then UPDATE, I just want them to be able to click
> each checkbox.
> Please help.
>
> thank you.

 
Reply With Quote
 
 
 
 
Rad [Visual C# MVP]
Guest
Posts: n/a
 
      12-27-2006
On Tue, 26 Dec 2006 15:53:00 -0800, Bret wrote:

> I am a VB Developer w/ SQL Server experience breaking into web world via the
> Visual Web Developer Express. I've already set up my data sources to my SQL
> Server tables and have created a grid view of my tables which executes
> successfully. Two of the fields in the gridview are checkboxes that are
> bound to a table, datatype is "bit". These 2 fields are "APPROVED" or
> "DENIED", in other words, the user needs to check approve or deny a record.
> My question is what is the right or best way to accomplish this task,
> gridview doesn't seem to accomplish this the way I'd like. Since a user can
> potentially have 100 records to approve, I dont want them to have to EDIT
> each record one by one and then UPDATE, I just want them to be able to click
> each checkbox.
> Please help.
>
> thank you.


You could also loop through each datagrid item, find the checkbox and check
if it is checked or not and then execute your custom logic
--
Bits.Bytes
http://bytes.thinkersroom.com
 
Reply With Quote
 
=?Utf-8?B?TWFuaXNoIEJhZm5h?=
Guest
Posts: n/a
 
      12-27-2006
Hi,
Only reason why i was insisting on ListView as compared to Datagrid was
because ListView is much lightweight than DataGrid and so performancewise it
would be good for you.I think you easily implement your funtionality with
ListView because you just want checkboxes.For which you just need to set one
property in ListView Control.

Thanks and Regards,
Manish Bafna.
MCP and MCTS

"Bret" wrote:

> I am a VB Developer w/ SQL Server experience breaking into web world via the
> Visual Web Developer Express. I've already set up my data sources to my SQL
> Server tables and have created a grid view of my tables which executes
> successfully. Two of the fields in the gridview are checkboxes that are
> bound to a table, datatype is "bit". These 2 fields are "APPROVED" or
> "DENIED", in other words, the user needs to check approve or deny a record.
> My question is what is the right or best way to accomplish this task,
> gridview doesn't seem to accomplish this the way I'd like. Since a user can
> potentially have 100 records to approve, I dont want them to have to EDIT
> each record one by one and then UPDATE, I just want them to be able to click
> each checkbox.
> Please help.
>
> thank you.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASPNET CheckBox and a CheckBox in a TemplateField Jason Huang ASP .Net 0 06-29-2007 12:35 AM
DataGrid and embeded Checkbox..How to find if checkbox clicked =?Utf-8?B?RG90TmV0RGV2?= ASP .Net 1 10-06-2006 04:11 PM
disable checkbox list checkbox Vikram ASP .Net 1 01-25-2006 02:59 PM
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked. Joey Pang ASP .Net Datagrid Control 4 06-13-2005 02:29 AM
Text on Checkbox below the checkbox tshad ASP .Net 0 04-14-2005 11:26 PM



Advertisments