how use radio button list in sharpoint web part

Posted by Sagarp under SharePoint on 11/24/2009 | Views : 8455 | Status : [Member] | Replies : 1
HI


I have to create sharpoint web part use radio button list ,check condation which radio button select.reply how use radio button list in sharpoint web part how can check it



Thnaks

sagarp

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/



Responses

Posted by: Vuyiswamb on: 11/24/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Lets say i have a radio button-list and and a button like this

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem>True</asp:ListItem>
<asp:ListItem>False</asp:ListItem>
</asp:RadioButtonList><br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="What have been Selected " /></div>
</form>
</body>
</html>


now if you want to check which radio button did you select then on the click event of your Button you will have something like this .

      if (RadioButtonList1.SelectedItem.ToString() == "True")

{
Response.Write("<script>alert('True is Selected');</script>");
}
else if (RadioButtonList1.SelectedItem.ToString() == "False")
{
Response.Write("<script>alert('False is Selected');</script>");
}


Thank you for posting at dotnetfunda

Vuyiswa Maseko


Thank you for posting at Dotnetfunda
[Administrator]

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response