Click here to Skip to main content
12,405,946 members (39,382 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
Hi All,
Iam saving that checkbox value(like yes/no)in database.I want to append that value in gridview.If that checkbox value is yes in that database i want to show that checkbox is checked other wise unchecked.


Thanks& Regards
Hari
Posted 9-Jan-13 0:40am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Save the Checkbox value in the database as Boolean or YES/NO
the checkbox should pick it up once you bind it
  Permalink  
Comments
   
@Joe_i
i saved that checkbox values like yes/no only.I want to show if value is yes in that time checkboxes are checked.how to bind that values to girdview
joe_j 9-Jan-13 9:10am
   
I believe that you are using an Item template to show the checkbox in the GridView. if that is so, then in the Template Edit mode you should be getting a Bind option
you should be getting something like this in the aspx code. the one below is for a DDL, you can modify it for a checkbox

<asp:TemplateField HeaderText="Status" SortExpression="status">

<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="AccessDataSource2"
DataTextField="status" DataValueField="status" SelectedValue='<%# Bind("status") %>'>



<asp:Label ID="Label1" runat="server" Text='<%# Bind("status") %>'>


here Status is the field that is pulled from the database.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

To check the checkbox checkbox1:
checkbox1.checked = true
To uncheck the checkbox checkbox1:
checkbox1.checked = false
  Permalink  
Comments
   
I want to check that value from database.
Any way thank you for your comment.
VitorHugoGarcia 9-Jan-13 7:43am
   
either you bind it as joe_j said or you get the value from db and test
if recordset.field.item.value = "Yes" then
checkbox1.checked = true
else
checkbox1.checked = false
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 6

I got the solution
Iam saving that checkbox value nw.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100