Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 10th, 2008, 01:27 AM
Registered User
Join Date: Jul 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Detailview with Checkbox

Hi Guys
   I am Created GridView with one of the Column having Checkbox.Using Template Field I created Chockbox for that particular column.see the code below
<asp:TemplateField HeaderText="Status" SortExpression="Status">
<asp:CheckBox ID="Ch1" runat="server" Enabled="false" Checked="false" />
It is displayed in the GridView.Now I created one Detailview for performing Edit operation.Here also I created Checkbox Using </asp:TemplateField> but I don't know how to perform the Update for Checkbox field,ie,I don't know how to find the Checkbox is checked or Unchecked and how to get the current value and store in the database..Please give any Sample code...

Old July 10th, 2008, 03:20 PM
Friend of Wrox
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts

loop through the gridview rows and find the control named Ch1 and see if it's checked or not

Dim gvRow as GridViewRow
For Each gvRow in GridView1.Rows
  If ctype(gvRow.FindControl("Ch1"), CheckBox).Checked = True Then
     'Do something here
  End IF

Jason Hall

Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing in DetailView using objectdatasourse balesh.mind ASP.NET 2.0 Professional 0 May 22nd, 2008 02:12 AM
Linking GridView to DetailView BOS ASP.NET 1.0 and 1.1 Basics 0 July 7th, 2007 12:40 AM
Detailview insert tombert ASP.NET 2.0 Basics 1 April 26th, 2007 05:00 AM
checkbox checked by default by html:checkbox sachin.tathod Struts 3 December 4th, 2006 03:41 PM
DetailView Control Showkkath ASP.NET 2.0 Professional 1 November 23rd, 2005 02:48 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.