button in dataview not firing after callback

661 Views Asked by At

I have an aspxdataview with images and buttons on it:

         <dx:ASPxDataView  ID="ASPxDataView1" runat="server" ClientInstanceName="dataview" DataSourceID="XmlDataSource1" SettingsTableLayout-RowsPerPage="2" Width="850px" PagerAlign="Justify" ItemSpacing="25px" OnCustomCallback="ASPxDataView1_CustomCallback" >
    <ItemTemplate>
        <table style="margin: 0 auto;">
            <tr>
                <td colspan="2">
                    <dx:ASPxImage ID="imgCover" runat="server" ImageUrl='<%# Eval("PhotoUrl") %>' Width="200px" Height="200px" ShowLoadingImage="true" />
                    <asp:Button ID="btnDelete" Text="X" runat="server" BackColor="Red" OnClientClick="return confirmPost()" OnClick="btnDelete_Click" />
                </td>
            </tr>
             <tr>
                <td>
                    <asp:TextBox ID="tbxName" runat="server" Text='<%# Bind("Name") %>' Width="125px" />
                    <asp:Button ID="btnRename" runat="server" Text="átnevez" OnClick="btnRename_Click" />
                </td>
            </tr>
        </table>
    </ItemTemplate>

When I upload an image the uploadcontrol calls a callback..

       <dx:ASPxUploadControl ID="ASPxUploadControl1" runat="server" UploadMode="Standard" Width="280px"
     (...)
        <ClientSideEvents FileUploadComplete="function(s, e) { dataview.PerformCallback('added'); }" />

..the handler then invokes databind on the dataview:

        protected void ASPxDataView1_CustomCallback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
    {ASPxDataView1.DataBind();}

The problem is that although the new item with the image appears, the delete button in it doesn't fire the click event (but some of the data items still disappear from the page when i click it), only after reloading the page. I'm getting very frustrated so I set a bounty on the issue.

1

There are 1 best solutions below

6
On

This should be a comment..but I don't have reputation.. sorry

Did you get any Javascript errors? (In developer tools)

----------------------------------------------------------

<asp:Button ID="btnDelete" Text="X" runat="server" BackColor="Red" OnClientClick="return confirmPost()" OnClick="btnDelete_Click" />

Try change to this

<asp:Button ID="btnDelete" Text="X" runat="server" BackColor="Red" OnClientClick="return confirm("Are you sure?");" OnClick="btnDelete_Click" />