Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an Ajax update panel, contains Parent grid and child grid. I want to export only child grid on a button click.This is what i have:

<br />
<pre lang="xml"><ajaxToolkit:TabPanel HeaderText="Trigger History" runat="server" Width="100%"><br />
                        <ContentTemplate><br />
                            <asp:GridView ID="gvSurgeDetails" runat="server" AutoGenerateColumns="false"<br />
                                ShowFooter="true" Width="1000px"<br />
                                OnRowDataBound="gvSurgeDetails_OnRowDataBound" OnPageIndexChanging ="gvSurgeDetails_PageIndexChanging" AllowPaging ="true" PageIndex="0" PagerSettings-Mode="Numeric" PagerSettings-PageButtonCount="10" PagerSettings-FirstPageText="First" PagerSettings-LastPageText ="Last"><br />
                                <Columns><br />
                                    <asp:TemplateField ItemStyle-Width="20px"><br />
                                        <ItemTemplate><br />
                                            <a href="JavaScript:divexpandcollapse('div<%# Eval("id") %>');"><br />
                                                <img id='imgdiv<%# Eval("SurgeLevelUpdateID") %>' width="9px" border="0"<br />
                                                    src="Images/plus.gif" alt="" /></a><br />
                                        </ItemTemplate><br />
                                        <ItemStyle Width="20px" VerticalAlign="Middle"></ItemStyle><br />
                                    </asp:TemplateField><br />
                                    <asp:TemplateField HeaderText="Update ID"><br />
                                        <ItemTemplate><br />
                                            <asp:Label ID="lblUpdateID" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,<br />
                                                                    "UpdateID") %>'></asp:Label><br />
                                        </ItemTemplate><br />
                                    </asp:TemplateField><br />
                                    <asp:BoundField DataField="UpdateDate" HeaderText="Updated At" /><br />
                                    <asp:BoundField DataField="By" HeaderText="Updated By" /><br />
                                    <asp:BoundField DataField="Color" HeaderText="Colour" /><br />
                                    <asp:BoundField DataField="Confirmation" HeaderText="CONFIRMATION" /><br />
                                    <asp:TemplateField><br />
                                        <ItemTemplate><br />
                                            <tr><br />
                                                <td colspan="100%"><br />
                                                    <div id='div<%# Eval("UpdateID") %>' style="overflow: auto; display: none; position: relative; left: 15px; overflow: auto"><br />
                                                        <asp:GridView ID="gv_Child" runat="server" Width="98%"<br />
                                                            AutoGenerateColumns="false" ><br />
                                                            <Columns><br />
                                                                <asp:BoundField DataField="Description" HeaderText="Description" /><br />
                                                                <asp:BoundField DataField="Value" HeaderText="Value" /><br />
                                                            </Columns><br />
                                                            <HeaderStyle BackColor="#4D92C1" ForeColor="White" /><br />
                                                        </asp:GridView><br />
                                                        <asp:LinkButton ID="gvChild_Export" OnClick="gvChild_Export_Click" runat="server" Text ="Export" CausesValidation="False" /><br />
<br />
                                                    </div><br />
                                                </td><br />
                                            </tr><br />
                                        </ItemTemplate><br />
                                    </asp:TemplateField><br />
                                </Columns><br />
                                <HeaderStyle BackColor="#0063A6" ForeColor="White" /><br />
<br />
                            </asp:GridView><br />
<br />
                        </ContentTemplate><br />
<br />
                    </ajaxToolkit:TabPanel></pre><br />
<br />


I want to export 'gv_child' on click of 'gvchild_export',If i try to add 'PostBackTrigger', it doesnt recognize the button obviously as its onside the Child Gridview.Is there a way to find button control thats inside the div where child grid is?
Posted
Updated 1-Oct-14 5:23am
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