Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am new to the C#. how to fetch the data from the database and display in the radio button.

The Radio Button items.

Male

Female
Posted
Comments
Jameel VM 31-Jul-13 2:19am    
ask to google..he will help you..
Jameel VM 31-Jul-13 2:20am    
before asking question like this please try atleast one time.. and then post the issues you have faced.
adriancs 31-Jul-13 2:46am    
not enough details. try to be more specific.

Have a look at similar question: How to save radio buttons value in database which are in two groups[^]

Next time, please, use SearchBox[^].
 
Share this answer
 
I would rather suggest you to go for radiobuttonlist.
process will become easy for you
refer the link[^] for further..
 
Share this answer
 
Please read ADO.Net first.

Now follow following steps.
1) create database in sqlserver.
2) create a new table or tables from which you wanna to fetch data.
3) in your c# code file create a SQL connection object with connection strings.
4) create dataadapter object
5) create dataset object
6) Now fill dataset using fill method of dataadapter object.
7) Now you have data fetched from database.
8) place a radio button list control with name "currentRadioButtonList"

And use following code snippet.

currentRadioButtonList.DataSource = currentDt;
currentRadioButtonList.DataTextField = strTxtField;
currentRadioButtonList.DataValueField = txtValueField;
currentRadioButtonList.DataBind();

foreach (ListItem item in currentRadioButtonList.Items)
item.Text = item.Text.Substring(0, 1);


Mark as answer if it suffice your query.

Regards,
Dheeraj Gupta
 
Share this answer
 

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