473,608 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checkbox functionality

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.
Dec 27 '06 #1
3 2520
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.Checke dIndexCollectio n checkedItems =
listView1.Check edIndices;

while (checkedItems.C ount 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.ListI tems.Count
ListView1.ListI tems(i).Checked = True
Next i
Else
For i = 1 To ListView1.ListI tems.Count
ListView1.ListI tems(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.
Dec 27 '06 #2
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
Dec 27 '06 #3
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.
Dec 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2538
by: Andy Lee | last post by:
Hi Is it possible to preset the values of form elements with php - so that when the client gets the page certain boxes are checked or completed - on the fly - based on their HTML id. Javascript has a way of doing this - but i need the functionality of PHP too - so if i can move the whole thing over to php it owuld be better . javascript example -
4
6592
by: Michael Champagne | last post by:
We have an application to where you can select/deselect all checkboxes in a checkbox array by clicking a 'master' checkbox at the top of the screen. This seems to work fine unless there is only one checkbox (these are dynamically generated). Why does this fail? If I do an alert(field_to_check.length) with 1 element in the array like this I get 'Undefined'. Is this because this datatype is not an array if there is only 1 element here? ...
4
2699
by: Imran Aziz | last post by:
Hello All, I display a list of entries with a checkbox against them using a repeater control bound to a database table. Based on the value of database table I want to either show the checkbox for a row or not to show, how do I accomplish that using a repeater control ? Should I do something like this <%if (((DataRowView)Container.DataItem) == 0) { %><asp:CheckBox ID="chkBookMarkID" text='<%#
3
3140
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method expects a DataGridColumn so I instantiated an object of type TemplateColumn that I had hoped I could add a CheckBox to. I soon discovered that the ItemTemplate property of the TemplateColumn class returned an object that had implemented the...
3
4432
by: newjazzharmony | last post by:
Hello group, I want to automatically select a specific checkbox when a user clicks (selects) a specific item in a radiobutton group. Both controls are in the same form. Let's say for argument's sake that the form looks like this (inessential items left out for the sake of clarity): <form name=form1>
1
1310
by: Pramod | last post by:
Dear All, I need to specify the value of a text field , when i select a checkbox in a HTML page (in other words..associating a input -text field to a standalone checkbox ) Based on the selection, i need to send the value specified in text field using MAILTO protocol. Can any one let me know, how can the above functionality be addressed with
7
7465
by: schaefty | last post by:
I recently posted this on the incorrect forum, and so I would like to ask the question here. I did get some good ideas on the other group, but I have not yet come up with a solution for me. I am using VS2005 (express edition) and coding in vb.net. I wrote an application that uses 30 checkboxes to set the configuration of a device. The device is constantly polled, and its response is decoded and reported in a mirror battery of another...
10
5193
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked. I set the AutoPostBack property of the CheckBox in the Header to True & am invoking a sub named 'CheckAllRows' on the CheckedChanged event of this CheckBox. The CheckBox in the Header exists within the HeaderTemplate of a TemplateColumn in the...
8
2350
by: Grorange | last post by:
Writing ASP.NET pages, I have a need for client-side functions to prevent going to the server for every small change. I have a list of server side created checkboxes filled with a lot of information being presented in a form on my site. In a JavaScript setup function, I attach the following event handler (I know syntax is wrong, I just simplified it for purposes within this post): <for every checkbox>onchange = function() { ...
0
7987
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8472
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8464
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8130
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8324
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6805
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4015
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2464
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.