如何通过asp.net中的会话将单选按钮的值传递给下一个表单? [英] how to pass value of radio buttons to next form through session in asp.net?

查看:176
本文介绍了如何通过asp.net中的会话将单选按钮的值传递给下一个表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用session n asp

解决方案

将单选按钮的值传递给下一个表单。只需在Session中存储单选按钮的值。



然后访问其他页面上的Session值。


设置AutoPostBack radiobutton的属性为true并在'OnCheckedChanged'事件中设置一个具有所选radiobutton值的会话变量



< asp:RadioButton ID =RadioButton1 Text =100
runat =serverOnCheckedChanged =RadioButton1_CheckedChangedAutoPostBack =true/>





和活动内部



  protected   void  RadioButton1_CheckedChanged( object  sender, System.EventArgs e)
{
if (RadioButton1.Checked == true
{
会话[ rbValue] = RadioButton1.Text; // 或设置另一个值
}


i want to know that how values of radio buttons are passed to next form using session n asp

解决方案

No need to pass. Just store the value of the radio button in Session.

Then access the Session value on other page.


Set the AutoPostBack property of radiobutton to true and set a session variable with selected radiobutton value inside 'OnCheckedChanged' event

<asp:RadioButton ID="RadioButton1" Text="100"
runat="server" OnCheckedChanged="RadioButton1_CheckedChanged" AutoPostBack="true"/> 



and inside the event

protected void RadioButton1_CheckedChanged(object sender, System.EventArgs e)
{
if (RadioButton1.Checked == true)
{
   Session["rbValue"] = RadioButton1.Text; // or set set another value
}


这篇关于如何通过asp.net中的会话将单选按钮的值传递给下一个表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆