如何使用c#在asp.net中使用列表视图在数据库中插入所选的单选按钮值 [英] How to insert selected radio button value in database using list view in asp.net using c#
本文介绍了如何使用c#在asp.net中使用列表视图在数据库中插入所选的单选按钮值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<b></b>This is my code. I want to insert the selected radio button value when clicked on NEXT button. Kindly help me with the aspx.cs code for the same.
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
<LayoutTemplate>
<table>
<asp:PlaceHolder runat="server" ID="itemplaceholder" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<img src='QuestionImages/<%#Eval("image") %>' height="1000" width="1000" />
</td>
</tr>
<tr>
<td>
<asp:Label text='<%#Eval("Question") %>' runat="server" />
</td>
</tr>
<tr>
<td>
<asp:RadioButton ID="option1" text='<%#Eval("Option1") %>' runat="server" GroupName="r1" />
</td>
</tr>
<tr>
<td>
<asp:RadioButton ID="option2" text='<%#Eval("Option2") %>' runat="server" GroupName="r1"/>
</td>
</tr>
<tr>
<td>
<asp:RadioButton ID="option3" text='<%#Eval("Option3") %>' runat="server" GroupName="r1"/>
</td>
</tr>
<tr>
<td>
<asp:RadioButton ID="option4" text='<%#Eval("Option4") %>' runat="server" GroupName="r1"/>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
推荐答案
使用项目检查事件并相应地获取值,稍后可将其保存到数据库中
Use Item Check event and get the values accordingly and later it can be saved into the database
这篇关于如何使用c#在asp.net中使用列表视图在数据库中插入所选的单选按钮值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文