Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net Gridview中的日历扩展程序控件会导致不必要的回发_Asp.net_Datepicker_Calendar_Postback_Ajaxcontroltoolkit - Fatal编程技术网

Asp.net Gridview中的日历扩展程序控件会导致不必要的回发

Asp.net Gridview中的日历扩展程序控件会导致不必要的回发,asp.net,datepicker,calendar,postback,ajaxcontroltoolkit,Asp.net,Datepicker,Calendar,Postback,Ajaxcontroltoolkit,在下面的代码中,如果在Gridview中使用Calendar extender控件和文本框,我将收到不必要的回发。这意味着在下面的代码中,当运行UpdateEmployeeInAppForm时会调用两次。在Gridview外部,它工作正常。有人能帮我吗 <asp:GridView ID="gvEmployee" runat="server" AutoGenerateColumns="false" ItemType="Employee"> <Columns

在下面的代码中,如果在Gridview中使用Calendar extender控件和文本框,我将收到不必要的回发。这意味着在下面的代码中,当运行UpdateEmployeeInAppForm时会调用两次。在Gridview外部,它工作正常。有人能帮我吗

<asp:GridView ID="gvEmployee" runat="server" AutoGenerateColumns="false" ItemType="Employee">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <table> <tr>
                                <td>Date Of Birth</td>
                                <td colspan="3">
                                    <asp:TextBox ID="tbDOB" runat="server" OnTextChanged="UpdateEmployeeInAppForm" AutoPostBack="true" Text='<%# Item.DOB%>'></asp:TextBox>

                                    <asp:CalendarExtender ID="tbDOB_CalendarExtender" runat="server" Format="dd MMMM yyyy" SelectedDate='<%# Item.DOB%>'
                                        Enabled="True" TargetControlID="tbDOB" ></asp:CalendarExtender>
                                </td>
                            </tr>
</table>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>

出生日期

以下是我找到的解决方案:

                              <asp:TextBox ID="tbDOB" runat="server" OnTextChanged="UpdateEmployeeInAppForm"  AutoPostBack="true" 
                                        Text='<%#Item.DOB.HasValue ? Item.DOB.Value.Date.ToString("dd MMMM yyyy") : "" %>'></asp:TextBox>                                        
                                    <asp:CalendarExtender ID="tbDOB_CalendarExtender" runat="server"   Format="dd MMMM yyyy"                                           
                                        Enabled="True" TargetControlID="tbDOB" ></asp:CalendarExtender>


从Calendar extender控件中删除SelectedDate=',并使文本框和日历中的格式相同

以下是我找到的解决方案:

                              <asp:TextBox ID="tbDOB" runat="server" OnTextChanged="UpdateEmployeeInAppForm"  AutoPostBack="true" 
                                        Text='<%#Item.DOB.HasValue ? Item.DOB.Value.Date.ToString("dd MMMM yyyy") : "" %>'></asp:TextBox>                                        
                                    <asp:CalendarExtender ID="tbDOB_CalendarExtender" runat="server"   Format="dd MMMM yyyy"                                           
                                        Enabled="True" TargetControlID="tbDOB" ></asp:CalendarExtender>

从Calendar extender控件中删除SelectedDate=',并使文本框和日历中的格式相同