Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.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
updatepanel中的工具导致完全回发asp.net c#_C#_Asp.net_Triggers_Postback_Html Select - Fatal编程技术网

updatepanel中的工具导致完全回发asp.net c#

updatepanel中的工具导致完全回发asp.net c#,c#,asp.net,triggers,postback,html-select,C#,Asp.net,Triggers,Postback,Html Select,我的在线订单有问题,我把我所有的下拉列表和按钮都放在updatepanel中,但是当我在下拉列表中选择某个内容时,或者当我按下按钮整页发回时…请帮助我!这是我的代码:` <strong><asp:ImageButton ID="btnExcel0" runat="server" AlternateText="Export to Excel" Heigh

我的在线订单有问题,我把我所有的下拉列表和按钮都放在updatepanel中,但是当我在下拉列表中选择某个内容时,或者当我按下按钮整页发回时…请帮助我!这是我的代码:`

                            <strong><asp:ImageButton 
                                ID="btnExcel0" runat="server" AlternateText="Export to Excel" Height="30px" 
                                ImageUrl="/images/excel_icon1.png" onclick="btnExcel_Click" TabIndex="14" />
                            </strong>&nbsp; &nbsp;&nbsp;
                             <input type="image" runat ="server" id ="Image1" src ="/images/images.jpg" onclick="javascript:CallPrint('divPivot1')" title="Print" />

                            <br />
                            <div id= "divPivot1">
                            <asp:GridView ID="OrderGridView" runat="server" AllowPaging="True" 
                                BorderStyle="None" CellPadding="3" DataKeyNames="Article" 
                                EmptyDataText="&quot;No product added...&quot;" Font-Size="Small" HorizontalAlign="Left" 
                                OnPageIndexChanging="OrderGridView_PageIndexChanging" PageSize="20" 
                                TabIndex="15" Width="866px" BackColor="White" BorderColor="#CCCCCC" 
                                BorderWidth="1px">
                                <FooterStyle BackColor="White" ForeColor="#336699" />
                                <HeaderStyle BackColor="#336699" Font-Bold="True" ForeColor="White" />
                                <PagerSettings FirstPageText="First" LastPageText="Last" />
                                <PagerStyle BackColor="White" ForeColor="#336699" HorizontalAlign="Left" />
                                <RowStyle ForeColor="#336699" Font-Size="Small" />
                                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                                <SortedAscendingCellStyle BackColor="#F1F1F1" />
                                <SortedAscendingHeaderStyle BackColor="#007DBB" />
                                <SortedDescendingCellStyle BackColor="#CAC9C9" />
                                <SortedDescendingHeaderStyle BackColor="#00547E" />
                                <Columns>
                                    <asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Center" >
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox1" runat="server" />
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                     <asp:TemplateField HeaderText="Update Quantity" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="80">
                                    <ItemTemplate>
                                        <asp:TextBox ID="TextBox" runat="server" Width="90" />
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
        br />
                                <br />
                               <asp:Label ID="lblsum" runat="server" CssClass="style19" Text="Sum Total"></asp:Label>
                            <br />
                               <asp:Label ID="sum" runat="server" CssClass="style19"></asp:Label>
                            <br />
                            </div>
                            <strong><asp:ImageButton ID="btnDelete" runat="server" Height="28px" 
                                    ImageUrl="/images/bt_Delete.jpg" onclick="btnDelete_Click" 
                                    OnClientClick="return DeleteConfirmation();" TabIndex="13" Width="106px" />
                                </strong>&nbsp;&nbsp;&nbsp; &nbsp;<asp:ImageButton ID="btnUpdate" 
                                    runat="server" Height="28px" ImageUrl="/images/btUpdate.jpg" Width="106px" 
                                    OnClientClick="return UpdateConfirmation();" 
                                    onclick="btnUpdate_Click" />
                            <asp:TextBox ID="username" runat="server" Height="16px" Visible="False" 
                                    Width="128px"></asp:TextBox>
                            <br />

                            <asp:Label ID="Label16" runat="server" Text="Notes:" ForeColor="#336699"></asp:Label>

                            <br />
                            <asp:TextBox ID="TextBox5" runat="server" Height="101px" TabIndex="10" 
                                TextMode="MultiLine" Width="860px"></asp:TextBox>
                            <br />
                            &nbsp;&nbsp;<asp:ImageButton 
                                ID="btnSend" runat="server" ImageUrl="/images/mail2.jpg" 
                                onclick="Button1_Click"  AlternateText="Send your Order"
                                TabIndex="11" Height="75px" Width="90px"/><strong><asp:ImageButton 
                                ID="ImageButton1" runat="server" Height="66px" 
                                ImageUrl="/images/logout.png"  Width="56px" 
                                 onclick="ImageButton1_Click" />
                            </strong>
                            <br />
                            <strong>
                            <asp:Label ID="Label18" runat="server" style="color: #336699" 
                                Text="*Delete Product from List: Check the products which you want to remove from your list and press the delete button."></asp:Label>
                            </strong>
                    </ContentTemplate>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="btnExcel0" />
                        <asp:AsyncPostBackTrigger ControlID="ImageButton1" />
                        <asp:AsyncPostBackTrigger ControlID="code" EventName="SelectedIndexChanged" />
                        <asp:AsyncPostBackTrigger ControlID="type" EventName="SelectedIndexChanged" />
                        <asp:AsyncPostBackTrigger ControlID="p" EventName="SelectedIndexChanged" />
                        <asp:AsyncPostBackTrigger ControlID="dem" EventName="SelectedIndexChanged" />
                        <asp:AsyncPostBackTrigger ControlID="quant" EventName="TextChanged" />
                        <asp:AsyncPostBackTrigger ControlID="btnAdd" />
                        <asp:AsyncPostBackTrigger ControlID="btnDelete" />
                        <asp:AsyncPostBackTrigger ControlID="btnUpdate" />
                        <asp:AsyncPostBackTrigger ControlID="btnSend" />
                    </Triggers>
                </asp:UpdatePanel>`



br/>






`
我看不到您下拉列表中的代码,我曾经遇到过同样的问题。 我设置下拉列表AutoPostBack=True,并在所选索引中定义一个方法。
因此,请确保您没有这样做,并上传完整的代码。

这是我的下拉列表之一。我不知道为什么,但我无法上传完整的代码。。。。我有4个下拉列表,updatepanel内有4个按钮和一个gridview。正如我所说,您的下拉列表包含两个内容,即AutoPostBack=true和选定索引上的事件已更改,因此您需要删除它们以避免回发。您是否在dropdownlist的选定索引更改事件内执行任何操作?受保护的无效代码\u SelectedIndexChanged(对象发送者,事件参数e){p.Items.Clear();p.Items.Add(新列表项(--Select p-->));type.AppendDataBoundItems=true;OrdersDataContext db=new OrdersDataContext();var selectType=(从db.typeTs中的t开始,其中(t.codeId==Convert.ToInt32(code.SelectedItem.Value))选择t.OrderBy(t=>t.type);type.DataSource=selectType;type.DataTextField=“type”;type.DataValueField=“id”;type.DataBind();if(type.Items.Count>2){type.Enabled=true;}否则{type.Enabled=false;dem.Enabled=false;}}
                            <strong><asp:ImageButton 
                                ID="btnExcel0" runat="server" AlternateText="Export to Excel" Height="30px" 
                                ImageUrl="/images/excel_icon1.png" onclick="btnExcel_Click" TabIndex="14" />
                            </strong>&nbsp; &nbsp;&nbsp;
                             <input type="image" runat ="server" id ="Image1" src ="/images/images.jpg" onclick="javascript:CallPrint('divPivot1')" title="Print" />

                            <br />
                            <div id= "divPivot1">
                            <asp:GridView ID="OrderGridView" runat="server" AllowPaging="True" 
                                BorderStyle="None" CellPadding="3" DataKeyNames="Article" 
                                EmptyDataText="&quot;No product added...&quot;" Font-Size="Small" HorizontalAlign="Left" 
                                OnPageIndexChanging="OrderGridView_PageIndexChanging" PageSize="20" 
                                TabIndex="15" Width="866px" BackColor="White" BorderColor="#CCCCCC" 
                                BorderWidth="1px">
                                <FooterStyle BackColor="White" ForeColor="#336699" />
                                <HeaderStyle BackColor="#336699" Font-Bold="True" ForeColor="White" />
                                <PagerSettings FirstPageText="First" LastPageText="Last" />
                                <PagerStyle BackColor="White" ForeColor="#336699" HorizontalAlign="Left" />
                                <RowStyle ForeColor="#336699" Font-Size="Small" />
                                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                                <SortedAscendingCellStyle BackColor="#F1F1F1" />
                                <SortedAscendingHeaderStyle BackColor="#007DBB" />
                                <SortedDescendingCellStyle BackColor="#CAC9C9" />
                                <SortedDescendingHeaderStyle BackColor="#00547E" />
                                <Columns>
                                    <asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Center" >
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox1" runat="server" />
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                     <asp:TemplateField HeaderText="Update Quantity" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="80">
                                    <ItemTemplate>
                                        <asp:TextBox ID="TextBox" runat="server" Width="90" />
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
        br />
                                <br />
                               <asp:Label ID="lblsum" runat="server" CssClass="style19" Text="Sum Total"></asp:Label>
                            <br />
                               <asp:Label ID="sum" runat="server" CssClass="style19"></asp:Label>
                            <br />
                            </div>
                            <strong><asp:ImageButton ID="btnDelete" runat="server" Height="28px" 
                                    ImageUrl="/images/bt_Delete.jpg" onclick="btnDelete_Click" 
                                    OnClientClick="return DeleteConfirmation();" TabIndex="13" Width="106px" />
                                </strong>&nbsp;&nbsp;&nbsp; &nbsp;<asp:ImageButton ID="btnUpdate" 
                                    runat="server" Height="28px" ImageUrl="/images/btUpdate.jpg" Width="106px" 
                                    OnClientClick="return UpdateConfirmation();" 
                                    onclick="btnUpdate_Click" />
                            <asp:TextBox ID="username" runat="server" Height="16px" Visible="False" 
                                    Width="128px"></asp:TextBox>
                            <br />

                            <asp:Label ID="Label16" runat="server" Text="Notes:" ForeColor="#336699"></asp:Label>

                            <br />
                            <asp:TextBox ID="TextBox5" runat="server" Height="101px" TabIndex="10" 
                                TextMode="MultiLine" Width="860px"></asp:TextBox>
                            <br />
                            &nbsp;&nbsp;<asp:ImageButton 
                                ID="btnSend" runat="server" ImageUrl="/images/mail2.jpg" 
                                onclick="Button1_Click"  AlternateText="Send your Order"
                                TabIndex="11" Height="75px" Width="90px"/><strong><asp:ImageButton 
                                ID="ImageButton1" runat="server" Height="66px" 
                                ImageUrl="/images/logout.png"  Width="56px" 
                                 onclick="ImageButton1_Click" />
                            </strong>
                            <br />
                            <strong>
                            <asp:Label ID="Label18" runat="server" style="color: #336699" 
                                Text="*Delete Product from List: Check the products which you want to remove from your list and press the delete button."></asp:Label>
                            </strong>
                    </ContentTemplate>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="btnExcel0" />
                        <asp:AsyncPostBackTrigger ControlID="ImageButton1" />
                        <asp:AsyncPostBackTrigger ControlID="code" EventName="SelectedIndexChanged" />
                        <asp:AsyncPostBackTrigger ControlID="type" EventName="SelectedIndexChanged" />
                        <asp:AsyncPostBackTrigger ControlID="p" EventName="SelectedIndexChanged" />
                        <asp:AsyncPostBackTrigger ControlID="dem" EventName="SelectedIndexChanged" />
                        <asp:AsyncPostBackTrigger ControlID="quant" EventName="TextChanged" />
                        <asp:AsyncPostBackTrigger ControlID="btnAdd" />
                        <asp:AsyncPostBackTrigger ControlID="btnDelete" />
                        <asp:AsyncPostBackTrigger ControlID="btnUpdate" />
                        <asp:AsyncPostBackTrigger ControlID="btnSend" />
                    </Triggers>
                </asp:UpdatePanel>`