Click here to Skip to main content
15,917,538 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Not getting the dropdown control on the form updated from table in the backend

1. Id No: txt_Id

2. Name : txt_Name

3 Gender : ddl_Gender


The gender is a drop down that has male/female as the options embedded


Table :: Trial

Idno Name Gender
------------------------
01 Paul male
02 Ivy female
03 Sal female


All the other controls work with the exception of the drop down.

Checked on the internt for the solution. The examples were not very clear.

Please provide sample codes or a good reference

Thanks

new to C#
Posted
Updated 27-Jun-14 20:51pm
v4
Comments
Pravuprasad 28-Jun-14 2:14am    
i am not getting your problem.Please explain these.
From the above 3 values what u retrieve from database and what you want to populate in dropdown?
Member 10744248 28-Jun-14 2:28am    
All 3 fields which are records on 'select' from gridview which is on the form.

All the field work with the exception of the dropdown control

1 solution

You should have two items declared for the DropDownList that are male and female.

As you are having directly stored male and female as strings, so you can declare the DropDownList items with value as male and female.

Now, when you retrieve the value from Database, you get either male or female for a particular row. Then just assign that as the SelectedValue property of the DropDownList so that correct option gets selected.
 
Share this answer
 
Comments
Member 10744248 28-Jun-14 3:38am    
Please provide a simple example , new to C#, moving from visual foxpro

Thanks
Member 10744248 28-Jun-14 3:40am    
or a refernce

Where is the Selectedvalue property

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