如何将单选按钮值存储在asp.net中的数据库中 [英] How can i store the radio button values in to the database in asp.net

查看:136
本文介绍了如何将单选按钮值存储在asp.net中的数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在单选按钮列表中有三个按钮,分别标记为是,否和NA,值分别为1,2和3。我从控件的编辑项目屏幕创建了列表。我想将该列表绑定到SQL Server表中名为Answer的字段,因此当用户单击标记为YES的按钮时,值1将进入答案字段。问题1:RB列表中的属性是否可以绑定文本框的方式绑定?



问题2:从值返回值时回发上的答案字段(假设值为3),列表中显示的唯一按钮是NA(我设置值为3)。我需要其他按钮保持可见,因为它们是替代选择,用户可能想要更改答案。那是怎么回事?



我正在研究一个小调查表,这些单选按钮至关重要。我看过几本书,网站,联系了一些开发人员;没运气。要么他们不明白我想要完成什么,要么无法完成。

I have three buttons in the Radio Button List labeled Yes, No and NA with values of 1,2 and 3 espectively. I created the list from the Edit Items screen for the control. I want to bind that list to a field called Answer in an SQL Server table so when the user clicks button labeled YES, a value of 1 goes into the Answer field. Question 1: Is there a property on the RB List that can be bound the same way one binds a text box?

Question 2: When a value is returned from the Answer field on postback (let's say the value is 3), the only button to show up in the list is NA (which I set with the value of 3). I need the other buttons to stay visible since they are the alternative choices and the user may want to change the answer. What's up with that?

I'm working on a small survey form where these radio buttons are crucial. I've looked in several books, web sites, contacted some developers; no luck. Either they don't understand what I'm trying to accomplish or it can't be done.

推荐答案

访问这里..

如何将radiobutton值存储到sql server数据库 [ ^ ]









将单选按钮值插入sqlserver数据库。 [ ^ ]
visit here..
how to store radiobutton value into sql server database[^]

or


Inserting radio button values into sqlserver database.[^]


< asp:radiobutton id =rb1text =Malerunat =serverxmlns:asp =#unknown>


$代码后面和后面的b $ b活动之间写了



rb1.SelectedItem.Value;



试试这个会帮到你
<asp:radiobutton id="rb1" text="Male" runat="server" xmlns:asp="#unknown">

in code behind and in between the event fired write

rb1.SelectedItem.Value;

Try this will help you


首先在数据库中,您可以为单选按钮值和问题编号创建单独的表。您可以将该值与相应的问题绑定到单选按钮列表。
First of in database you can create separate table for your radio button value and question number. Than you can bind that value to radio button list with respective questions.


这篇关于如何将单选按钮值存储在asp.net中的数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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