Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 6th, 2010, 10:15 PM
Authorized User
Points: 395, Level: 6
Points: 395, Level: 6 Points: 395, Level: 6 Points: 395, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2007
Location: London, , United Kingdom.
Posts: 73
Thanks: 4
Thanked 0 Times in 0 Posts
Default Gridview bit column

Hi,
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>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
DataKeyNames="Contestantid"
DataSourceID="SqlDataSource1"

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

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


</Columns>
</asp:GridView>

<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">

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

</asp:SqlDataSource>
<asp:Label ID="lblMessage" runat="server"
Font-Bold="True"></asp:Label><br />
<br />
<br />
</div>
</form>
</body>
</html>
__________________
Cheers
Sheraz
Reply With Quote
  #2 (permalink)  
Old June 7th, 2010, 02:42 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
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!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:52 PM.


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