C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

Checkbox


Posted Date: 07 Nov 2009      Posted By: kannan      Member Level: Gold     Points: 1   Responses: 2



I am use itemtemplate of checkbox inside the gridview when i bound data from database it says like dbnull conversion error...the code snippet as below,


<asp:checkbox ID="chkYearly" Checked='<%# Eval("Yearly")%>' Width="187px" runat="server"></asp:checkbox>

the code behind Yearly coloumn will return 0/1 ???

how to resolve it and it should be checked/unchekced based on the 1/0

regards,
kannak...





Responses

Author: Satinder Kumar    07 Nov 2009Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

try this

<asp:checkbox ID="chkYearly" Checked='<%#iif(not isdbnull(Eval("Yearly")),Eval("Yearly"),0)%>' Width="187px" runat="server"></asp:checkbox>



Author: kannan    07 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

hi,

its perfect....thanks

regards,
kannak......



Post Reply
You must Sign In to post a response.
Next : Logout
Previous : ASPxGridView Popup Edit Form for Spin Edit column
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use