Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
Prevent a click from beeing fired
posted

Hello,

 

I have a problem with the WebDataGrid.

I want to implement a "are you sure"-question when a user clicks a cell / row.

In the case of a "Cancel" the click event should not be fired.

If "OK" has been clicked, the click should be fired and a new page will be opened.

 

I have this code in my aspx page:

 

<ig:WebDataGrid ID="grdCompanyList" runat="server"
                    DataKeyFields="objectNo"
                    DataSourceId="odsCompanyList"
                    AutoGenerateColumns="false"
                    StyleSetPath="~/Styles/Grids" CssClass="InfoOverviewGrid"
                    StyleSetName="Claymation" ShowFooter="true"  ClientEvents-Click="onClick">

 

and the javascript function looks like that:

 

        function onClick(sender, eventArgs) {

            var continueSelect = confirm('Are you sure you want to select this object?!');

            if (!continueSelect)
                eventArgs.set_cancel(true);
            }
        }

 

 

But the click is fired no matter if Cancel or OK has been selected.

What is the matter? Does it work at all this way? Whats missing?

Why is it always fired?

 

I would be glad about any help.

 

Thanks

 

Parents
No Data
Reply
  • 33839
    Suggested Answer
    posted

    Hi tiger1x,

    I'm not entirely sure if you can cancel a click event like that.  But since you're doing it off of a row or cell, why don't you turn on selection or activation and use the active cell changed or cell/row selection changed client event.  Then you could confirm in there and then manually fire off the navigation.

    regards,

    David Young

Children
No Data