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
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 3rd, 2004, 02:32 PM
Authorized User
 
Join Date: May 2004
Location: , , USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default checkbox in datagrid

I am getting an 'Specific cast is not valid' error when I bind a datagrid to a dataset.

I am returning a 0 or 1 in the 'depends' field in my SQL.

In my datagrid I have:

                                    <ItemTemplate>
                                        <asp:CheckBox ID="chkIncluded" Runat=server Checked='<%# DataBinder.Eval(Container.DataItem,"depends") %>' >
                                        </asp:CheckBox>
                                    </ItemTemplate>


SS
__________________
SS
Reply With Quote
  #2 (permalink)  
Old June 3rd, 2004, 03:11 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Try casting it to the proper form:

<%# CType(DataBinder.Eval(Container.DataItem,"depends" ), Boolean) %>

or

<%# (bool)DataBinder.Eval(Container.DataItem,"depends" ) %>
Reply With Quote
Reply


Thread Tools
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
CheckBox in Datagrid sumith ASP.NET 1.0 and 1.1 Professional 1 March 21st, 2007 07:25 AM
checkbox in datagrid asad_prog VB.NET 0 November 25th, 2006 02:41 PM
CheckBox in DataGrid Baby_programmer ASP.NET 1.x and 2.0 Application Design 2 March 11th, 2005 12:42 AM
CheckBox in DataGrid Baby_programmer ASP.NET 1.0 and 1.1 Basics 1 March 3rd, 2005 08:33 PM
checkbox in datagrid joekske VB How-To 1 June 3rd, 2004 03:31 PM



All times are GMT -4. The time now is 02:36 PM.


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