473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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="GridViewProspectSearch" runat="server" CellPadding="4"
EmptyDataText="No prospects found." ForeColor="#333333"
GridLines="None">
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White"
/>
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="CheckBoxSelect" runat="server"/>
</ItemTemplate>
</asp:TemplateField>

</Columns>
<PagerStyle BackColor="#FFCC66" ForeColor="#333333"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True"
ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White"
/>
<AlternatingRowStyle BackColor="White" />
</asp:GridView>

My code to detect selection is:
foreach (GridViewRow row in GridViewProspectSearch.Rows)
{
CheckBox cbx = (CheckBox)row.FindControl("CheckBoxSelect");
if (cbx.Checked)
{
//Get the personId
}
}

Any ideas here? Thanks.

Jun 27 '08 #1
1 1241
Hi Robby,

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

microsoft.public.dotnet.framework.aspnet.datagridc ontrol 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****@microsoft.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****@newsgroup.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:GridView ID="GridViewProspectSearch" runat="server" CellPadding="4"
EmptyDataText="No prospects found." ForeColor="#333333"
GridLines="None">
<FooterStyle BackColor="#990000" Font-Bold="True"
ForeColor="White"
>/>
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="CheckBoxSelect" runat="server"/>
</ItemTemplate>
</asp:TemplateField>

</Columns>
<PagerStyle BackColor="#FFCC66" ForeColor="#333333"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True"
ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True"
ForeColor="White"
>/>
<AlternatingRowStyle BackColor="White" />
</asp:GridView>

My code to detect selection is:
foreach (GridViewRow row in GridViewProspectSearch.Rows)
{
CheckBox cbx = (CheckBox)row.FindControl("CheckBoxSelect");
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
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...
0
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...
1
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...
2
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...
0
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...
2
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...
3
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...
1
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...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.