Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

 
Share this answer
 
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

SQL
DropDownColumnName = CASE tablecoulmname
WHEN tablecoulmname = 1 THEN "Yes" 
WHEN tablecoulmname = 0 THEN "No"
ELSE defaultvalue as per your requirement


Hope this will help you.
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900