Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
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.NET
<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>

HTML
My Modal Pop Up Code

ASP.NET
<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>

C#
cs code:

C#
    protected void Edit(object sender, EventArgs e)
{
        Number = txt.Text;
        var list=getDate(Number)
        Gridview3.DataSource = getDate;
        Gridview3.DataBind();
        modalPopup.Show();
}
Posted
Updated 3-Apr-16 21:11pm

1 solution

can you try asp.net UpdatePanel Control ??

UpdatePanel Control Overview[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900