We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

I need to confirm on one SplitItem

Hello,

i have a dialog, that is filled by an AJAX-ASPX-Webforms-page. Working great so far. Now on this page is a SplitButtom with different SplitItems. One of those shall show a confirm-dialog like "You really want to delete?" and if the user clicks "yes" it shall call a generic handler not to change page. Can someone please help?

5 Replies

FP Francis Paul Antony Raj Syncfusion Team April 12, 2017 04:44 PM UTC

Hi Carsten, 
 
Thanks for contacting Syncfusion Support. 
 
We have analyzed your query. We understand that you are performing AJAX post on SplitButton Item Click event handler and you would like to prevent the AJAX Post with confirmation message when user click one specific item. We have prepared a simple sample to show case this scenario - Sample 
 
Please refer the below code example: 
 
[aspx] 
<ej:SplitButton ID="SplitButton" runat="server" Size="Large" ShowRoundedCorner="true" Text="Save" ClientSideOnItemSelected="onItemClick"> 
            <Items> 
                <ej:SplitItem Text="Open"></ej:SplitItem> 
                <ej:SplitItem Text="Save"></ej:SplitItem> 
                <ej:SplitItem Text="Delete"></ej:SplitItem> 
            </Items> 
</ej:SplitButton> 
 
[script] 
        function onItemClick(args) { 
 
            if ((args.text == "Delete" && !confirm('You really want to delete?')) || args.text != "Delete") {//prompt the USER  
 
                    $.ajax({ 
                        contentType: "application/json; charset=utf-8", 
                        type: "POST", 
                        url: "ButtonFeatures.aspx/Page1", 
                        dataType: "json", 
                        data: {}, 
                        success: function (xhr) { 
                            alert(xhr.d) // Ajax success  
                        }, 
                        error: function (xhr) { 
                            alert("Error"); // error alert if something went wrong  
                        } 
                    }); 
                } 
            // ajax post not occurs when Delete prompt is confirmed 
        } 
 
[aspx.cs] 
 
        [System.Web.Services.WebMethod] 
        public static string page1() 
        { 
            return "Hello " + Environment.NewLine + "The Current Time is: " 
                + DateTime.Now.ToString(); 
        } 
 
Please get back to us, if you need further assistance. 
 
Regards, 
Francis Paul A. 



CW Carsten Wuttke April 13, 2017 02:49 PM UTC

Hello Francis,
thx for the reply. I forgot to mention, that I create the Button and its items by code behind. And already found the solution. This here is working:
                              splitItem.Text = "Delete";
                            splitItem.Url = "javascript: deleteit('" + se.EncryptData(Data) + "')";
                            splitItem.SpriteCssClass = "remove";

BTW: How can I create such a neat box with Syntax-Highlighting in the Forum? ;-)


FP Francis Paul Antony Raj Syncfusion Team April 17, 2017 06:19 AM UTC

Hi Carsen, 
 
Thanks for the update. We glad to know that you have achieved your requirement in Code-Behind. 
 
Query: How can I create such a neat box with Syntax-Highlighting in the Forum? 
 
To create a code block with Syntax-Highlighting, please copy the code block from Visual Studio and paste it in the forum and to create a box, use the table option available in the RTE Toolbar under Message section of the Forum. 
 
Regards, 
Francis Paul A. 



CW Carsten Wuttke April 18, 2017 10:39 AM UTC

Hello Franis ;-),

thx for the info. Thought there were an option without the overhead of Microsofts C&P. But thx anyway.
Greets,
Carsten


SP Sureshkumar P Syncfusion Team April 19, 2017 11:40 AM UTC

Hi Carsten, 
We have an option to achieve your requirement (How can I create such a neat box with Syntax-Highlighting in the Forum) in our RTE tollbar with custom tool option. 
For your convenience, we have created the RTE sample with custom tool option. Here clicks the insert code button and then add your code block. 
 Please refer the jsplayground link: http://jsplayground.syncfusion.com/vecpbmpa.  
To know more about custom tool option in RTE please refer the below documentation link:  
Regards, 
Sureshkumar P 


Loader.
Live Chat Icon For mobile
Up arrow icon