Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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
Hari Krishna Prasad Inakoti at 9-Jan-13 7:46am
   
@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 at 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
Hari Krishna Prasad Inakoti at 9-Jan-13 7:16am
   
I want to check that value from database.
Any way thank you for your comment.
VitorHugoGarcia at 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)



Advertise | Privacy | Mobile
Web04 | 2.8.141022.2 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2014
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