views:

86

answers:

1

Looked to various posts on here but couldn't find one quite like it, I know this is going to be something small but I just can't figure it out.

I am using a gridview inside an update panel. The gridview is using the auto generated delete column converted into a templatefield column. Here is the code:

<asp:GridView ID="gvFiles" runat="server" AutoGenerateColumns="False" 
        CellPadding="4"
        ForeColor="#333333" GridLines="None">
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <Columns>
            <asp:TemplateField HeaderText="Files" HeaderStyle-HorizontalAlign="Left">

            <ItemStyle Width="210px" />
            <ItemTemplate>
                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#Eval("Id", "~/Download.aspx?id={0}")%>'><%#Eval("LinkName")%></asp:HyperLink>,<br />
                Last Modified: <%#Me.cutDate(Eval("DateModified"))%>
            </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False" HeaderText="Team">
            <ItemStyle Width="150px" />
            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                <ItemTemplate>
                    <%#Me.GetTeamName(Eval("TeamId"))%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="lbDelete" runat="server" CausesValidation="False" 
                        CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure you want to delete this post?');"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>

        </Columns>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#999999" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>

I've got this exact same code working fine when it's not inside the update panel. What do I need to do to get this to work?

Edit: Forgot to mention, my update panel settings are all default. Also what happens is you click delete, the confirmation message pops up, you click Yes, and then nothing happens.

A: 

I think you will have to add this

<Triggers>
    <asp:AsyncPostBackTrigger ControlID="btnFindOrder" EventName="Click" />
</Triggers>
Terry
I assume the ControlID should be "lbDelete", and I tried that, but it says `A control with ID 'lbDelete' could not be found for the trigger in UpdatePanel 'UpdatePanel1'.`
sah302
lbDelete is inside the gridview which means it will have an id of ctrl001_gvFiles_(something)_lbDelete. It's something like that. Run the page and then look for lbDelete. The issue with this though is that each row created will have a different ID for lbDelete and it should increment it.
Terry