模态弹出扩展器显示时如何避免页面刷新? [英] How to avoid page refresh when modal popup extender displays?

查看:106
本文介绍了模态弹出扩展器显示时如何避免页面刷新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I Have Two Pages when I press the Link Button in Gridview1 of FirstPage it will Redirects To Second Page and Append Text in Textbox and Displys Gridview2.i Wrote this Logic is (!IsPostBack), Now when i Press the Link Button in GridView2 of Second Page Another Gridview3 is Displayed in Modal Popup Extender.

My Issue is When i Press the Link Button in Gridview2 of Second Page GridView3 is Displayed but page is Refreshed..i want to Avoid the Page Refresh and In Modal Pop up Extender Close Button will not be Worked. How can i resolve this...

What I have tried:

My Code










<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <asp:UpdatePanel ID="gv_UpdatePanel" runat="server">
        <ContentTemplate>
        <div>
            <asp:GridView runat="server" ID="GridView2" DataKeyNames="OrderId"

                OnRowDataBound="GridView2_OnRowDataBound" 

                OnRowEditing="GridView2_RowEditing" 

                OnRowCancelingEdit="GridView2_RowCancelingEdit" OnRowUpdating="GridView2_RowUpdating"

                AutoGenerateColumns="false" CssClass="ChildGrid_font" GridLines="None" 

                <Columns>                          
                    <asp:BoundField HeaderText="Number" SortExpression="No" DataField="No"

                    <asp:BoundField HeaderText="OrderId" SortExpression="OrderId" DataField="OrderId"

                    <asp:BoundField HeaderText="Date" SortExpression="Date" DataField="Date"

                    <asp:TemplateField HeaderText="Audit">
                    <ItemTemplate>
                     <asp:LinkButton ID="Linkbtn" runat="server" Text="Show" OnClick="Edit"></asp:LinkButton>
                    </ItemTemplate>
                    </asp:TemplateField>                        
                </Columns>
            </asp:GridView>

    </ContentTemplate>
    </asp:UpdatePanel>




My Modal Pop Up Code




<asp:Button ID="btnTemp" runat="server" Visible="false" />
            <asp:ModalPopupExtender ID="modalPopup" runat="server"  TargetControlID="btnTemp" PopupControlID="popup" CancelControlID="btnCancel">
            </asp:ModalPopupExtender>
             <asp:Panel ID="popup" runat="server">

             <div>
            <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="false" GridLines="None">
                <AlternatingRowStyle BackColor="#e7e8e9" />
                <RowStyle BackColor="#f5dec0" />
                <Columns>
                    <asp:BoundField HeaderText="Id" SortExpression="Id" DataField="Id"

                     <asp:BoundField HeaderText="Number" SortExpression="No" DataField="No"

                </Columns>
            </asp:GridView>

            </div>
             <asp:Button ID="btnCancel" runat="server" Text="Cancel"/>
    </asp:Panel>




cs code:




    protected void Edit(object sender, EventArgs e)
{
        Number = txt.Text;
        var list=getDate(Number)
        Gridview3.DataSource = getDate;
        Gridview3.DataBind();
        modalPopup.Show();
}

推荐答案

你能试试asp.net UpdatePanel控制吗?



UpdatePanel控制概述 [ ^ ]
can you try asp.net UpdatePanel Control ??

UpdatePanel Control Overview[^]


这篇关于模态弹出扩展器显示时如何避免页面刷新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆