Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 June 6th, 2010, 10:15 PM
Authorized User
Join Date: May 2007
Posts: 73
Thanks: 4
Thanked 0 Times in 0 Posts
Default Gridview bit column

I have a column of type bit, I want to display checkboxes on bases of values 1 and 0. So that in edit mode if i unchecked the box then the database should contain the value 0.

Can anyone help on this please.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="__admin_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server"

<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:TemplateField HeaderText="ID" SortExpression="ID">
<asp:Label ID="lblID" runat="server"
Text='<%#Eval("ContestantId") %>'>
<asp:Button ID="btnInsert" runat="server"
Text="Insert" CommandName="Add" />

<asp:TemplateField HeaderText="FirstName"
<asp:Label ID="lblFirstName" runat="server"
Text='<%#Eval("iContestantName") %>'>
<asp:TextBox ID="txtFirstName" runat="server"
Text='<%#Bind("iContestantName") %>'>
<asp:TextBox ID="txtFname" runat="server">


<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:sdasdadasConnectionString%>"

SelectCommand="SELECT [ContestantID], [iContestantName] ,[iContestantCompany] ,[iContestantStore] ,[iNominationText] ,[iNominatorPhone] ,[iNominatorEmail], [Activate] FROM [SMOTY_tblContestantabc]"
UpdateCommand="UPDATE [SMOTY_tblContestant] SET [iContestantName] =@iContestantName where [ContestantID] = @ContestantId">

<asp:Parameter Name="iContestantName" Type="string" />
<asp:Parameter Name="ContestantID" Type="int32" />

<asp:Label ID="lblMessage" runat="server"
Font-Bold="True"></asp:Label><br />
<br />
<br />
Old June 7th, 2010, 02:42 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi there,

And you need help with what exactly? You haven't even told us what the bit column is....

Are you aware of the CheckBoxField?

Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
bit column in datagrid dhoward VB.NET 2002/2003 Basics 5 December 6th, 2007 12:34 PM
How to add a new column into gridview? Bryan Stanley ASP.NET 2.0 Basics 0 September 12th, 2007 10:49 PM
64 Bit - Issue in 64 bit IIS calling Win32 API Hubman General .NET 1 August 24th, 2006 09:19 AM

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