0

私のGridView:

<asp:GridView ID="MyGridView" runat="server" ShowFooter="true"
                                AutoGenerateColumns="False" Visible="True">
<Columns>
<asp:BoundField DataField="id" ItemStyle-HorizontalAlign="center"/>
<asp:BoundField DataField="fullName"  />
<asp:TemplateField HeaderText="situation>">
<ItemTemplate>
  <asp:DropDownList ID="dl_situation" runat="server">
   </asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField>
 <ItemTemplate>
         <asp:TextBox ID="tbNr" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>  
<asp:TemplateField HeaderText="Data">
<ItemTemplate>
 <asp:TextBox ID="tbDate" runat="server"></asp:TextBox>
 <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
      ErrorMessage="*" ControlToValidate="tbDate">
   </asp:RequiredFieldValidator>
 </ItemTemplate>
</asp:TemplateField>     
</Columns>
</asp:GridView>

GridViewを埋めようとすると、エラーが発生しました

Uncaught Sys.WebForms.PageRequestManagerServerErrorException:     
Sys.WebForms.PageRequestManagerServerErrorException: Exception has been 
thrown by the target of an invocation. ScriptResource.axd:847
Error$create ScriptResource.axd:847
PageRequestManager$_createPageRequestManagerServerError ScriptResource.axd:765
PageRequestManager$_parseDelta ScriptResource.axd:1654
PageRequestManager$_onFormSubmitCompleted ScriptResource.axd:1415
$type.createDelegate ScriptResource.axd:628
$type.getHandler ScriptResource.axd:4338
raise ScriptResource.axd:7248
WebRequest$completed ScriptResource.axd:7252
Sys.Net.XMLHttpExecutor._onReadyStateChange

このページのリソースでは、このエラーはここにあります

$type.create = function Error$create(message, errorInfo) {
    /// <summary locid="M:J#Error.create">Use this method to create a new error.   
   </summary>
    /// <param name="message" type="String" optional="true" mayBeNull="true">
     The error message.</param>
    /// <param name="errorInfo" optional="true" mayBeNull="true">
   A plain JavaScript object that contains extended information about the error.  
    The object should have a 'name' field that contains a string that identifies 
 the error   and any additional fields that are necessary to fully describe 
 the error.</param>
    /// <returns type="Error">An Error object.</returns>
    var e = Function._validateParams(arguments, [
        {name: "message", type: String, mayBeNull: true, optional: true},
        {name: "errorInfo", mayBeNull: true, optional: true}
    ]);
    if (e) throw e;

    var err = new Error(message);
**Uncaught Sys.WebForms.PageRequestManagerServerErrorException: 
Sys.WebForms.PageRequestManagerServerErrorException: 
 Exception has been thrown by the target of an invocation.**
    err.message = message;

    if (errorInfo) {
        for (var v in errorInfo) {
            err[v] = errorInfo[v];
        }
    }

    err.popStackFrame();
    return err;
}
4

1 に答える 1

5

同じ問題が発生し、GridViewItemTemplateのバリデーターにClientIDMode="AutoID"を追加することで解決しました。

于 2013-12-17T05:22:19.473 に答える