C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

RadioButtons


Posted Date: 04 Nov 2009      Posted By: Naresh      Member Level: Silver     Points: 1   Responses: 4



Hi All,

i am retrieving data from database(i.e one column data from db).i am getting four values(Select names from table).i have to add radiobutton for each value.
like this Naresh RadioButton
Nadimpalli Radiobutton
xyz Radibutton
abc RadioButton





Responses

Author: vipul    04 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Hi,
you want add only "Radiobutton" string after each name or you want control after each name?
if you want to control then you can used radiobutton list control

<asp:RadioButtonList ID="test" runat="server">
<asp:ListItem Text="1" Value="1"></asp:ListItem>
<asp:ListItem Text="2" Value="1"></asp:ListItem>
<asp:ListItem Text="3" Value="1"></asp:ListItem>
<asp:ListItem Text="4" Value="1"></asp:ListItem>
</asp:RadioButtonList>


and if you want to in your way than you can used repeater control this way and bind you datasource to repeater control

<asp:Repeater ID="TEST" runat="server">
<ItemTemplate>
<%# Eval("Name") %><asp:RadioButton ID="rdb1" runat="server" />
</ItemTemplate>
</asp:Repeater>


Please Rate This Answer If They Helpful

Thanks & Regards
Patel Vipul



Author: Kishor Dalwadi    04 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

Use RadiobuttonList.

And Give DataResult as a Datasource.



Author: Abhay    04 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Create a datasource and asign to the radiobuttonlist

Example:
.aspx


<asp:RadioButtonList ID="RadioButtonList1" runat="server">
</asp:RadioButtonList>


.aspx.cs


string strReferral = "SELECT PK_REFERRING_PHYS_ID,(last_name +', '+first_name + ' ' + middle_name ) as NAME " +
"FROM m_referring_physicians mrp WHERE mrp.status = 1 ";
DataSet dsPe = SqlHelper.ExecuteDataset(new Connection().GetCon, CommandType.Text, strReferral);
RadioButtonList1.DataSource = dsPe;
RadioButtonList1.DataValueField = "PK_REFERRING_PHYS_ID";
RadioButtonList1.DataTextField = "NAME";
RadioButtonList1.DataBind();


Thanks and Regards,
Abhay



Author: pradeep kumar reddy    04 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

U have to go to radio button list. and u have to choose the database from which u want to retrieve data. and u have to mention the data text field and data value field


Post Reply
You must Sign In to post a response.
Next : Default DataType in c#.net and vb.Net
Previous : Code for printing of windows form
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use