473,769 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CheckBox and GridView

Hi,

In my ASPNET2.0 C# webform, I have a GridView1 which has CheckBox1 on it.
If the GridView1 has 10 rows, is it possible to restrict the GridView to
have just one CheckBox checked?
given that the CheckBox1's AutoPostBack is not true.
I am thinking using the JavaScript to accomplish this purpose, but I don't
handle the JavaScript well at this moment.
Thanks for help.
Jason
Jul 6 '07 #1
1 1817
Hello Jason,
Hi,

In my ASPNET2.0 C# webform, I have a GridView1 which has CheckBox1 on
it.
If the GridView1 has 10 rows, is it possible to restrict the GridView
to
have just one CheckBox checked?
given that the CheckBox1's AutoPostBack is not true.
I am thinking using the JavaScript to accomplish this purpose, but I
don't
handle the JavaScript well at this moment.
Thanks for help.
Jason
Why don't you use Radiobuttons ?
It is not common to bind radiobutton list and i'm posting you some articles
describing how this can be acomplish

http://www.codeproject.com/aspnet/Ho...p_RButtons.asp
http://www.codeproject.com/aspnet/Ra...nList_Demo.asp

regards
Martin
Jul 6 '07 #2

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

Similar topics

1
2878
by: Bill44077 | last post by:
I am dynamically adding a checkbox in a gridview and I find there are several things that I cannot figure out how to address. 1. The width of the checkbox column is very wide. I've tried adding properties and Item Style to the column but it has no effect. Is there someway to size this column to be smaller? I removed the CssClass property and it had no effect on the size as well. 2. The gridview is sortable using javascript. Is there...
0
3295
by: Jayender | last post by:
Hi , I have placed checkbox in my gridview .. now when i check the chekbox and click anybutton the checkbox becomes unchecked. but when i normally add checkbox in the page it doesnt happen but it happens when i add it to the gridview. why is that ? i have added checkbox like this in my gridview: .......
1
21472
by: mercercreek | last post by:
This one should be easy. Hope someone has a clue. Simple Scenario: Gridview with mulitple rows, each row with a checkbox. The user checks boxes of her choice. Clicks a button on the form (not in the grid). Desired aciton is then taken in response to the button_onclick event relevant to the row in which the checked checkboxes exist. Unfortunate Outcome: Each checkbox returns false for its attribute:checked whether the user has placed a...
9
5535
by: mike7510uk | last post by:
Hi, I am using a gridview with a templatefield containing a checkbox. I want to update the database with a 1 or 0 depending on if a checkbox is checked or unchecked (then use the 1 or 0 later on another page)..i have been google around and found this.... If e.Row.RowType = DataControlRowType.DataRow Then Dim Chk As CheckBox = e.Row.FindControl("CheckBox1") just dont know what to do next...Any ideas?
2
5140
by: JonBosker | last post by:
I am having a strange problem - my GridView is displaying bits (from SQL Server) as checkboxes (which is fine) but it shows each alternating one centrally aligned. Heading1 Heading2 Text Checkbox Text2 Checkbox Text3 Checkbox Text4 Checkbox
1
2394
by: Ben | last post by:
Hi, I'm designing a c# page and trying to add a checkbox column to a GridView, I've added a Template Row (as described at: http://aspnet.4guysfromrolla.com/articles/052406-1.aspx) and in the Edit Templates dragged a Checkbox into the Item Template. The new column shows up, but it's empty...no checkbox appears. Any ideas? here's the source if it helps:
1
9097
by: aurovinda | last post by:
Hi I send the detail code below.I have the problem when i click the checkbox there is no effect on the gridview's row.Again after a few seconds the checkbox is automatically unchecked.There is no error shows.Please help me. ======================================= protected void rowedit(object sender, EventArgs e) { foreach (GridViewRow row in GridView1.Rows) { CheckBox status =...
1
4171
by: Danielle | last post by:
Greetings all and thanks in advance for any help you can provide. I am trying ultimately to get values from a gridview row when a checkbox on the row is checked. the problem I'm having is that after ticking the checkbox, the whole page refreshes (expectedly), the checkbox is unmarked and the response.write message displayed below never displays. It follows that if I uncomment the lines that try to capture the value in cell(3) and...
0
2439
by: dotnetrookie | last post by:
Hi This is my 1st post.I have two checkbox columns in gridview binded through item template. The checkboxes are Category and Subcategory. I have actually removed the duplicate values in the 1st column so that Category is listed only once for the corresponding subcategories. Now I need to make sure that the all the subcategory checkboxes to be checked when the corresponding category checkbox is checked. The issue is that only the first...
1
3794
by: janetb | last post by:
I have a gridview with an update capabilities - a textbox column (roomName), a dropdownlist(orgID), a dropdownlist(roomTypeID),a checkbox column (dialOut), a checkbox column (dialIn). When I try to add another checkbox column, the sql database isn't updated properly with a 0/1 or false/true but with null. I've tried everything I can think of. Can anyone help? Data command stuff: UpdateCommand="update telehealth.dbo.xTblRoom...
0
10222
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
10050
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
9999
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
9866
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
8876
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
7413
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
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
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.