UpdatePanel 在Listview嵌套Listview中失效

Listview嵌套Listview

UpdatePanel 实现局部刷新

第二个 Listview中有一个RadioButtonList,选择NG时,后台实现备注文本框必填。这个动作需要局部刷新,而不是刷新整个页面,目前这个方法是整体刷新。
HTML代码如下:

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Laser_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>TEST</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>
            <asp:Literal ID="Literal1" runat="server"></asp:Literal>
            <table class="TbTemplate">
                <tr>
                    <td colspan="8">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:ListView ID="ListView1" runat="server"
                                    OnItemDataBound="ListView1_ItemDataBound">
                                    <LayoutTemplate>
                                        <table style="width: 100%; border-collapse: collapse">
                                            <tr id="Tr1" class="LV1TbTh" runat="server" style="background-color: #3a90c9; color: #ffffff">
                                                <th class="LV1td1">检查项目</th>
                                                <th class="LV1td2">检查内容</th>
                                                <th class="LV1td3">检查结果</th>
                                                <th class="LV1td4">备注</th>
                                            </tr>
                                            <tr id="itemPlaceholder" runat="server">
                                            </tr>
                                        </table>
                                    </LayoutTemplate>
                                    <ItemTemplate>
                                        <tr class="LV1Item">
                                            <td class="LV1td1"><%# Eval("Item_Name") %></td>
                                            <td colspan="3">
                                                <asp:ListView ID="ListView2" runat="server" OnItemDataBound="ListView2_ItemDataBound">
                                                    <LayoutTemplate>
                                                        <table class="LV2itemPlaceholderContainer" style="width: 100%; border-collapse: collapse">
                                                            <tr>
                                                                <asp:PlaceHolder runat="server" ID="itemPlaceholder" />
                                                            </tr>
                                                        </table>
                                                    </LayoutTemplate>
                                                    <ItemTemplate>
                                                        <tr class="LV2TbItem">
                                                            <td class="LV1td2"><%# Eval("Content_Name") %></td>
                                                            <td class="LV1td3">
                                                                <div style="width: 80%; float: left">
                                                                    <asp:RadioButtonList ID="RadioButtonList_LV2" runat="server" RepeatDirection="Horizontal" Width="100%"
                                                                        OnTextChanged="RadioButtonList1_TextChanged" AutoPostBack="true">
                                                                        <asp:ListItem>OK</asp:ListItem>
                                                                        <asp:ListItem>NG</asp:ListItem>
                                                                        <asp:ListItem>NA</asp:ListItem>
                                                                    </asp:RadioButtonList>
                                                                </div>
                                                                <div style="width: 20%; float: left">
                                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="检查结果必选!"
                                                                        ControlToValidate="RadioButtonList_LV2" ValidationGroup="Laser_New_Submit" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
                                                                </div>
                                                            </td>
                                                            <td class="LV1td4">
                                                                <asp:TextBox ID="TextBox_LV2" runat="server" CssClass="LV1asptxt" TextMode="MultiLine" Rows="2" Height="48px"></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="选择NG后必选!"
                                                                    ControlToValidate="TextBox_LV2" ValidationGroup="Laser_New_Submit" ForeColor="Red" Text="*" Enabled="false"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                    </ItemTemplate>
                                                </asp:ListView>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:ListView>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
            </table>
            <div style="margin-bottom: 10px; width: 99%">
                <asp:Button ID="Button1" runat="server" Text="提交" CssClass="btnsubmit" ValidationGroup="Laser_New_Submit" OnClick="Button1_Click" />
                <asp:ValidationSummary ID="ValidationSummary1" HeaderText="错误列表:" runat="server" EnableClientScript="true"
                    ShowMessageBox="true" ShowSummary="false" DisplayMode="BulletList" ValidationGroup="Laser_New_Submit" />
            </div>
        </div>
    </form>
</body>
</html>

后台代码部分:

 protected void RadioButtonList1_TextChanged(object sender, EventArgs e)
    {
        try
        {
            RadioButtonList rbl = sender as RadioButtonList;
            if (rbl != null)
            {
                ListViewDataItem LV1dataitem = rbl.Parent as ListViewDataItem;
                if (rbl.SelectedValue == "NG")
                {

                    ((RequiredFieldValidator)LV1dataitem.FindControl("RequiredFieldValidator2")).Enabled = true;
                }
                else
                {
                    ((RequiredFieldValidator)LV1dataitem.FindControl("RequiredFieldValidator2")).Enabled = false;
                }
            }
        }
        catch (Exception ex)
        {
            Literal1.Text = ex.ToString();
        }
    }

请各位大神帮忙看看:
1.为什么不能实现局部刷新,实际状况为整体页面刷新(测试过如果listview不嵌套,只有一个listview,最外面放一个UpdatePanel是起作用的,嵌套之后就不行了。)
2.还有什么方式实现,listview2中选择NG,备注项目必填!
图片说明

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!