Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
hello friends,
 
can anybody help me with this issue.
 
I have two dropdownlist inside gridview with value yes and no. database contains all the fields i have to fetch and fill it in gridview. for the dropdowns the database contains 0 and 1. I have to make the dropdowns yes if value is 1 and no value is 0 for all the rows fetched from the database. can anybody provide me any idea regarding it.
 
thanking you.
Posted 7-Oct-12 6:28am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi,
 
Implement GridView_RowDataBound event and into this check the value of dropdown. And after that change the item accordingly.
 
Other option is to user CASE clause in your query and get the exact data from database as you want to display.
 
Modify queyr as below
 
 
DropDownColumnName = CASE tablecoulmname
WHEN tablecoulmname = 1 THEN "Yes" 
WHEN tablecoulmname = 0 THEN "No"
ELSE defaultvalue as per your requirement
 
Hope this will help you.
  Permalink  
v2

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

  Print Answers RSS
0 Maciej Los 450
1 OriginalGriff 403
2 Sergey Alexandrovich Kryukov 239
3 CPallini 189
4 CHill60 180
0 OriginalGriff 6,092
1 Sergey Alexandrovich Kryukov 4,972
2 Maciej Los 3,269
3 Peter Leow 3,129
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 8 Oct 2012
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