473,770 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView Checkboxes

I'm having trouble picking up the checked state of checkboxes in my GridView.
I'm working in VS2008.

I added a TemplateField via smartTag "Edit Columns". My GridView markup is:

<asp:GridView ID="GridViewPro spectSearch" runat="server" CellPadding="4"
EmptyDataText=" No prospects found." ForeColor="#333 333"
GridLines="None ">
<FooterStyle BackColor="#990 000" Font-Bold="True" ForeColor="Whit e"
/>
<RowStyle BackColor="#FFF BD6" ForeColor="#333 333" />
<Columns>
<asp:TemplateFi eld>
<ItemTemplate >
<asp:CheckBox ID="CheckBoxSel ect" runat="server"/>
</ItemTemplate>
</asp:TemplateFie ld>

</Columns>
<PagerStyle BackColor="#FFC C66" ForeColor="#333 333"
HorizontalAlign ="Center" />
<SelectedRowSty le BackColor="#FFC C66" Font-Bold="True"
ForeColor="Navy " />
<HeaderStyle BackColor="#990 000" Font-Bold="True" ForeColor="Whit e"
/>
<AlternatingRow Style BackColor="Whit e" />
</asp:GridView>

My code to detect selection is:
foreach (GridViewRow row in GridViewProspec tSearch.Rows)
{
CheckBox cbx = (CheckBox)row.F indControl("Che ckBoxSelect");
if (cbx.Checked)
{
//Get the personId
}
}

Any ideas here? Thanks.

Jun 27 '08 #1
1 1269
Hi Robby,

Regarding on this issue, I have also found your another thread in the

microsoft.publi c.dotnet.framew ork.aspnet.data gridcontrol newsgroup.

I've posted a reply there. Welcome to continue followup in that thread.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no
rights.-------------------->From: =?Utf-8?B?Um9iYnlE?=
<ro****@newsgro up.nospam>
>Subject: GridView Checkboxes
Date: Fri, 23 May 2008 07:08:05 -0700
>
I'm having trouble picking up the checked state of checkboxes in my
GridView.
>I'm working in VS2008.

I added a TemplateField via smartTag "Edit Columns". My GridView markup
is:
>
<asp:GridVie w ID="GridViewPro spectSearch" runat="server" CellPadding="4"
EmptyDataText=" No prospects found." ForeColor="#333 333"
GridLines="Non e">
<FooterStyle BackColor="#990 000" Font-Bold="True"
ForeColor="Whit e"
>/>
<RowStyle BackColor="#FFF BD6" ForeColor="#333 333" />
<Columns>
<asp:TemplateFi eld>
<ItemTemplate >
<asp:CheckBox ID="CheckBoxSel ect" runat="server"/>
</ItemTemplate>
</asp:TemplateFie ld>

</Columns>
<PagerStyle BackColor="#FFC C66" ForeColor="#333 333"
HorizontalAlig n="Center" />
<SelectedRowSty le BackColor="#FFC C66" Font-Bold="True"
ForeColor="Nav y" />
<HeaderStyle BackColor="#990 000" Font-Bold="True"
ForeColor="Whit e"
>/>
<AlternatingRow Style BackColor="Whit e" />
</asp:GridView>

My code to detect selection is:
foreach (GridViewRow row in GridViewProspec tSearch.Rows)
{
CheckBox cbx = (CheckBox)row.F indControl("Che ckBoxSelect");
if (cbx.Checked)
{
//Get the personId
}
}

Any ideas here? Thanks.

Jun 27 '08 #2

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

Similar topics

0
1037
by: Bob Keller | last post by:
I've been working on a web project (VB) previously done with DataGrids in VS2003. I've migrated the project over to VS2005, because I like what I've seen of the newer features. Soooo.. I've got a gridview with nothing but multiple checkboxes to be used for indicating the status of a request. I'm using Oracle 9x for my DBMS and Oracle's .NET data access client. Getting the each of the checkboxes populated from the database is not a...
0
1994
by: Faybert | last post by:
Hello, and Thanks in advance for any light you might shed on my troubles. I'm trying to setup a series of checkboxes, or a checkboxlist to control the results that are shown on a gridview control. I have a column in my database that hold the current status of the items in there. If I used a checkboxlist and populate it with my options, and set the SQL statement on my gridview control to: "SELECT , , , FROM WHERE
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...
2
11236
by: deepa.ravikiran | last post by:
Hi, I am trying to create a ASPX page which will list items with a checkbox beside each. The user has to be able to select items using the checkbox to do some further processing. If I use a gridview control, the checkboxes are all disabled, and I find that I have to have a Edit button for each row, and after clicking the Edit button, the row check box gets enabled. Is there any way that I can use the Gridcontrol (or any other ASPX web
0
4197
by: =?Utf-8?B?V0I=?= | last post by:
Hi, I have a .NET page which has a gridview of customers from Northwind database. There's a checkbox for each customer and the gridview allows paging. I would like to be able to persist the checkbox status while paging. I'm starting with the code below but I can't get it to work. You can check some of the checkboxes and when you click on the pager, no selection is reflected by the trace. Why's that?
2
2830
by: GISmatters | last post by:
I have unbound checkboxes in a nested gridview to allow multi-selection of "child" rows. For context, the parent gridview rows are for large "reports", the child rows are for various specific files comprising each report. I want the user to be able to select an arbitrary collection of report files and have them emailed by clicking an "Email selected files" button. Everything displays properly, including the checkboxes for each child row (each...
3
9009
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= | last post by:
Hi, I have a GridView with a checkbox column in it called FromInsight, however this is not bound to the dataset, its value is based on another column from the dataset called sourceid For each row FromInsight = true if (SourceId 0). I try to loop around the gridview and add the value of the checkbox but the column seems to have no checked value, please can you help with this. Thanx in advance Robert
1
4520
Frinavale
by: Frinavale | last post by:
I'm working on an ASP.NET application using VB.NET for server side code. I have a GridView listing a bunch of stuff. Above the GridView I have a checkbox named "ChkBx_SelectAll". If this checkbox is checked, all of the rows in the GridView are checked, if this checkbox is unchecked, all of the rows in the GridView are unchecked. This checking/unchecking of the checkboxes in the GridView is handled by a JavaScript method: function...
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...
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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
10257
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
9904
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...
1
7456
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
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4007
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
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.