【问题标题】:How to get value in textbox based on Radibutton Checked and how to get radibutton gets checked when value given in Textbox in GRIDVIEW in asp.net [closed]如何在基于选中的单选按钮的文本框中获取值以及如何在 asp.net 的 GRIDVIEW 中的文本框中给出的值时检查单选按钮 [关闭]
【发布时间】:2014-09-24 06:46:56
【问题描述】:

我有一个任务要做。下面是我的网格视图,其中包含 QNO 和 QuestionName 以及 Answerview 和 Answer 列。..

在这里,当我检查单选按钮时,会自动在文本框中获取该值(意义为 1、2、3、4、5),反之亦然(当我在文本框中给出值时,如 1 或 2 或 3..对应的单选按钮应该检查..

请帮帮我...

我的 gridview 模型是::

<asp:GridView ID="gvquestions" runat="server" CssClass="txt" ForeColor="#333333"
    GridLines="Vertical" CellPadding="6" Width="720px" AutoGenerateColumns="false">
    <Columns>
        <asp:BoundField HeaderText="Question.No" DataField="SubscriptionID" />
        <asp:BoundField HeaderText="Question Name" DataField="SubType" />
        <asp:TemplateField HeaderText="Answer View">
            <ItemTemplate>
            <asp:RadioButtonList ID="rbtnanswerview" RepeatDirection="Horizontal" runat="server">
            <asp:ListItem Text="" Value="1"></asp:ListItem>
            <asp:ListItem Text="" Value="2"></asp:ListItem>
            <asp:ListItem Text="" Value="3"></asp:ListItem>
            <asp:ListItem Text="" Value="4"></asp:ListItem>
            <asp:ListItem Text="" Value="5"></asp:ListItem>
            </asp:RadioButtonList>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Answer">
            <ItemTemplate>
            <asp:TextBox ID="txtanserview" Width="40px" runat="server"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    <EditRowStyle BackColor="#999999" />
    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#E9E7E2" />
    <SortedAscendingHeaderStyle BackColor="#506C8C" />
    <SortedDescendingCellStyle BackColor="#FFFDF8" />
    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>

【问题讨论】:

  • 嗨..我在问建议..单选按钮更改事件在gridview内部起作用,textchangedevent在gridview内部起作用..我不是在问代码..只是建议..我想在我的方式。

标签: c# asp.net gridview


【解决方案1】:

您需要使用gridview 的FindControl 功能。 单选按钮列表 rbl=gridview.findcontrol("rblName"); 文本框 txt=gridview.findcontrol("txtname");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-28
    • 2021-11-13
    • 1970-01-01
    • 1970-01-01
    • 2013-02-09
    • 2016-04-09
    • 2012-07-31
    相关资源
    最近更新 更多