Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.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 使用UpdatePanel.Update()但没有结果_Asp.net_Ajax_Jquery Mobile_Asp.net Ajax_Updatepanel - Fatal编程技术网

Asp.net 使用UpdatePanel.Update()但没有结果

Asp.net 使用UpdatePanel.Update()但没有结果,asp.net,ajax,jquery-mobile,asp.net-ajax,updatepanel,Asp.net,Ajax,Jquery Mobile,Asp.net Ajax,Updatepanel,我有一个aspx网页包含jquery mobile,我不知道为什么,每当我调用UpdatePanel.Update()在我的代码中,就会出现一个白色页面!当然,页面不是空的,因为当我查看源代码(ctrl+u)时,所有内容都可用。奇怪的是,对于一个页面中的一个调用,两个ajax请求提交,因此两个不同的响应收到两个不同的post参数。第一个请求中的Post如下所示: ScriptManager:UpdatePanel1 | grdRequests$ctl03$btnCancel __ASYNCPOS

我有一个aspx网页包含jquery mobile,我不知道为什么,每当我调用UpdatePanel.Update()在我的代码中,就会出现一个白色页面!当然,页面不是空的,因为当我查看源代码(ctrl+u)时,所有内容都可用。奇怪的是,对于一个页面中的一个调用,两个ajax请求提交,因此两个不同的响应收到两个不同的post参数。第一个请求中的Post如下所示:

ScriptManager:UpdatePanel1 | grdRequests$ctl03$btnCancel __ASYNCPOST:true __论点:没什么 __事件目标:什么都没有 __EVENTVALIDATION:此处的值 __LASTFOCUS:什么都没有
__此处的VIEWSTATE值

回答是这样的:

1 |#| | | 4 | 5451 |更新面板|更新面板1|

但在第二个请求中,并没有ScriptManager和ASYNCPOST参数,同样在响应中,只有旧内容无法看到更多的数据。有什么想法吗

客户端:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ConfOne.aspx.cs" Inherits="ConfDC"%>
<!DOCTYPE html> 
<html> 
    <head> 
    <meta name="viewport" content="width=device-width, initial-scale=1" /> 

    <link rel="stylesheet" href="jquery.mobile-1.1.1.min.css" />
    <script src="jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="jquery.mobile-1.1.1.min.js" type="text/javascript"></script>
</head> 
<body> 
<form id="form1" runat="server" dir="rtl" defaultbutton="btnpage" name="form1">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode = "Conditional">
    <ContentTemplate>
    <table>
        <tr>
            <td>
                <asp:Button runat="server" ID="btnpage" Width="1px" Height="1px"  Visible="false"/>
                 <asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
            </td>
        </tr>
    </table>
<div id="mcnt">
    <div data-role="page">
    <div data-role="content" style="padding: 10px; text-align: center;">

        <asp:GridView ID="tbls runat="server" AutoGenerateColumns="False" Width="100%"
            CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt"
            CellPadding="1" CellSpacing="1" AllowPaging="True" DataKeyNames="Id" OnRowCommand="tbls_RowCommand"
            OnPageIndexChanging="tbls_PageIndexChanging">
            <Columns>
                <asp:TemplateField HeaderText="Amount">
                    <ItemTemplate>
                        <asp:Label ID="lblAmount" runat="server" Text='<%# Bind("Amount") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle/>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Button Text="Decline" ID="btnCancel" CommandName="CancelRequest" runat="server"
                            CommandArgument='<%# DataBinder.Eval(Container, "DataItem.id") %>' />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Button Text="Accept" ID="btnConfirm" CommandName="ConfirmRequest" runat="server"
                            OnClientClick="return confirm('Are you sure?');"
                            CommandArgument='<%# DataBinder.Eval(Container, "DataItem.id") %>' />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
            </Columns>
            <PagerStyle CssClass="pgr"></PagerStyle>
            <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
        </asp:GridView>
        </div>
        <div id="rsnCnt">                     
        <asp:Panel ID="pnlReasons" Width="100%" runat="server" Visible="false">
             <fieldset>
                <asp:TextBox runat="server" ID="txtReasons" CssClass="TextArea" Height="70px" Width="100%"
                                TextMode="MultiLine"></asp:TextBox>
                <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
                <div id="btnActionCnt">
                    <div style="float:right;">
                        <asp:Button type="button" runat="server" ID="btnCancelRequest" Width="100px" class="groovybutton2"
                                Text="OK " OnClientClick="return confirm('are you sure?');" />
                    </div>
                     <div style="float:left;"> 
                    <asp:Button type="button" runat="server" ID="btnCancel" class="groovybutton2" Text="NOT OK"
                        onmouseover="" onmouseout=""
                        OnClick="btnCancel_Click" Height="25px" Width="100px" />        
                    </div>
                </div>
            </fieldset>
        </asp:Panel>
    </div>
    </div>
</div>   
     </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>         
protected void tbls_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "CancelRequest")
    {
        pnlReasons.Visible = true;
        UpdatePanel1.Update();

    }
}   

您将在哪里绑定gridview。。 你需要把它绑起来

private void Page_Load()
{
    if (!IsPostBack)
    {
        // Need to Bind your grid here
    }
}

我不知道为什么,但当我删除updatepanel时,它工作正常。

此外,我们还需要更多的信息。一些服务器和客户端代码如何?将ScriptManager控件移出UpdatePanel1我移动了ScriptManager,但它并没有解决问题,而是在将我的页面更新到我的主页index.aspx之后!!!我不明白为什么???是的,我完全绑定了它,但这不是我的问题。为什么不尝试将GridView设置为更新面板的AsyncPostBackTrigger