2
votes

i have some problem in gridview inside the update panel. when i am using this code at gridview row command event for button :

    if (dr.Read())
    {
        Byte[] pdfData = (byte[])dr.GetValue(0); ;
        Response.Buffer = true;
        Response.ContentType = "application/PDF";
        Response.BinaryWrite(pdfData);
       // Response.End();
    }

i click @ gridview button (gridview in update panel) then dun open pdf file, but i remove gridview from updatepanel then gridview button is working fine and open file. please suggest that how to manage gridview button in updatepanel.

1

1 Answers

0
votes

If you have the conditional attribute set to true in your update panel, you may need to add the button as a trigger for your update panel.

 <asp:UpdatePanel ID="UpdatePanel9" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            ...your gridview...
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="yourbutton" />
        </Triggers>
    </asp:UpdatePanel>