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)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 1,518
1 OriginalGriff 503
2 Manas Bhardwaj 393
3 Tadit Dash 310
4 Damith Weerasinghe 290
0 Sergey Alexandrovich Kryukov 9,575
1 OriginalGriff 5,856
2 Peter Leow 4,405
3 Maciej Los 3,540
4 Abhinav S 3,513


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