Data form fire command argument not getting passed to ItemCommand event handler

2 posts, 0 answers
  1. YoonSoo
    YoonSoo avatar
    1 posts
    Member since:
    Oct 2015

    Posted 30 Jun 2017 Link to this post


    I have a javascript function (see below) that fires perform insert command for a data form. I am trying to pass the command argument of the button clicked to the ItemCommand event handler but somehow e.CommandArgument.ToString() tunrs out to be an empty string. Can anyone please guide me as to what i am doing wrong?


    function callSaveAll(sender,args) {                 
                            var object2 = $find("<%= OrderItemDataForm.ClientID%>");                       
                                if (object2._isItemInserted)
                                    object2.fireCommand("PerformInsert", args._commandArgument);                                                                     


    .cs code:

    protected void OrderItemDataForm_ItemCommand(object sender, RadDataFormCommandEventArgs e)

            if (e.CommandName == "Cancel")
                ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CancelEdit();", true);

            if (e.CommandName == "PerformInsert")
                if (Page.IsValid)
                    if (e.CommandArgument.ToString() == "SaveNew")
                        saveAndNewButtonClicked = true;
                    else if (e.CommandArgument.ToString() == "Save")
                        saveAndNewButtonClicked = false;
  2. Marin Bratanov
    Marin Bratanov avatar
    4050 posts

    Posted 04 Jul 2017 Link to this post

    Hi YoonSoo,

    If this question is still valid after our discussions in your support threads, I can suggest you look into:

    • Using a standard button with its CommandArgument set. This button's CommandName can be PerformInsert. With this, the e.CommandArgument will be set to the button's property value. RadButton allows you to set the command argument via JS.
    • Having several buttons with the desired command arguments and showing/hiding the necessary ones according to your logic.
    • Using a hidden field as a flag. You can use .FindControl() from the inserted item to reach it.


    Marin Bratanov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top