Hai, I am coding in C# using visual studio 2010.
In my application i want a link between a text box in one form and radio button in another form.
Please send the code for it.
In my application there are 3 radio buttons in one form.And these three must select automatically based on the values of textbox in another form.
for example textbox is for students marks and radio buttons for grades.If in textbox marks are above 70 then first radio button will automatically select(as A grade).or if marks or above 60 then second radio button will automatically select(as B grade). something like this......
sourabh mishraPosted Mar 1, 2013, 3:09 AM
Page1.aspx
<asp:TextBox ID="TextBox1" runat="server">asp:TextBox>
<asp:Button ID="Button1"
runat="server" Text="Next Page" onclick="Button1_Click" />
//Page1.aspx.cs
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text != "")
{
Session["Value"] = TextBox1.Text; Response.Redirect("~/Default4.aspx");
}
}
//Page2.aspx
<asp:RadioButton ID="RadioButton1" runat="server" Text="Grade A" />
<asp:RadioButton ID="RadioButton2" runat="server" Text="Grade B" />
<asp:RadioButton ID="RadioButton3" runat="server" Text="Grade C" />
//Page2.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToInt32( Session["Value"]) >= 70)
{
RadioButton1.Checked = true; RadioButton2.Checked = false;
RadioButton3.Checked = false;
}
else if (Convert.ToInt32(Session["Value"]) >= 60 && Convert.ToInt32(Session["Value"]) <= 69)
{
RadioButton1.Checked =false;
RadioButton2.Checked = true ;
RadioButton3.Checked = false ;
}
else if (Convert.ToInt32(Session["Value"]) >= 50 && Convert.ToInt32(Session["Value"]) <= 59)
{
RadioButton1.Checked = false;
RadioButton2.Checked =false;
RadioButton3.Checked = true;
}
}
For above code u can solve ur problem. If this is helpful pls mark my answer. or any question regarding this u canpost ur question here.