Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - GridView Checkboxes

Reply
 
Old 05-23-2008   #1 (permalink)
RobbyD


 
 

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.


My System SpecsSystem Spec
Old 05-26-2008   #2 (permalink)
Steven Cheng [MSFT]


 
 

RE: GridView Checkboxes

Hi Robby,

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

microsoft.public.dotnet.framework.aspnet.datagridcontrol 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:
msdnmg@xxxxxx.

==================================================
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?=
<robbyd@xxxxxx>
Quote:

>Subject: GridView Checkboxes
>Date: Fri, 23 May 2008 07:08:05 -0700
Quote:

>
>I'm having trouble picking up the checked state of checkboxes in my
GridView.
Quote:

>I'm working in VS2008.
>
>I added a TemplateField via smartTag "Edit Columns". My GridView markup
is:
Quote:

>
><asp:GridView ID="GridViewProspectSearch" runat="server" CellPadding="4"
> EmptyDataText="No prospects found." ForeColor="#333333"
>GridLines="None">
> <FooterStyle BackColor="#990000" Font-Bold="True"
ForeColor="White"
Quote:

>/>
> <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"
Quote:

>/>
> <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.
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
"Checkboxes" pther things look weird General Discussion
Vista icons error--checkboxes, etc. look weird Vista General
CTP Out-GridView PowerShell
system icon checkboxes grayed out Vista performance & maintenance


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46