0

在 DropDownList SelectedIndexChanged 上,页面回发并在单选按钮中记录开发人员的姓名。当用户单击 GridView 上的更新链接时,我希望customValidator检查Radiobutton 是否为空

<EditItemTemplate>
   <table>
       <tr>
          <td>
              <asp:DropDownList ID="_ddlAllDev" runat="server" AutoPostBack = "true" DataTextField = "Text"
                   DataValueField = "Value" OnSelectedIndexChanged = "ddlAllDev_SelectedIndexChanged">
              </asp:DropDownList>
          </td>
        </tr>
        <tr>
           <td>
              <asp:RadioButtonList ID="_rblAllDev" runat="server" AutoPostBack = "true" DataTextField = "Text"
                   DataValueField = "Value" OnSelectedIndexChanged = "rblAllDev_SelectedIndexChanged">
              </asp:RadioButtonList>
              <asp:CustomValidator ID="_valDev" runat="server" ControlToValidate = "_rblAllDev" Text = "*" 
                   ErrorMessage="Please choose at leat one developer for this task" OnServerValidate = "AllDev_ServerValidate" />
           </td>
        </tr>
     </table>    
</EditItemTemplate>

问题是,在用户单击 GridView 上的 UPPDATE 链接后,似乎甚至没有调用 CustomerValidator 处理程序。我在方法中放置了一个断点,但该方法甚至没有被调用。

protected void AllDev_ServerValidate(object sender, ServerValidateEventArgs args)
{

}

我错过了什么吗?

感谢您的帮助。

4

0 回答 0