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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Dialog - ejDropDownList get selected code

Thread ID:

Created:

Updated:

Platform:

Replies:

124840 Jul 3,2016 03:46 PM UTC Jul 6,2016 04:09 AM UTC ASP.NET Web Forms 3
loading
Tags: Grid
Pratheep
Asked On July 3, 2016 03:46 PM UTC

Hi


How to get  ejDropDownList get selected code  in code behind 


  if ((args.requestType == "beginedit" || args.requestType == "add")) {

   $("#ShipCountry").ejDropDownList({ width: '116px', dataSource: args.model.columns[0].dataSource, fields: { text: "Text", value: "Text", id: "Id" } });

}

  if (args.requestType == "beginedit") {

     $("#ShipCountry").ejDropDownList("setSelectedValue", args.row.children().eq(4).text());
}

 protected void EditAction(string eventType, object record)
    {

            can i get select ejDropDownList selected Id  
  
    }

Pratheep

Attachment: dropdownlist_1ac941e5.rar

Ragavee U S [Syncfusion]
Replied On July 4, 2016 09:07 AM UTC

Hi Pratheep, 

Based on your requirement, we have modified your sample to obtain “Id” value of the item selected in dropdownlist at the server side, which can be downloaded from the below location. 


In the above sample, we have dynamically triggered the “endEdit” event of the Grid by passing the required parameters to the server side. Please refer to the below code example. 

function begin(args) { 
                    if(args.requestType == "save"){ 
                        var dropData = $("#ShipCountry").ejDropDownList("instance"); 
                        dropDownModel = dropData.getItemDataByValue(dropData.getSelectedValue())[0].Id; //get the Id of the selected Item 
                        } 
                } 
 
function endEdit(args) { 
            flag++; 
            if (args.dropDownModel == undefined) { 
                if (flag == 1) 
                    triggerEvent(args); 
                flag = 0; 
                return false 
            } 
             
        } 
        function triggerEvent(e) { 
            var obj = $("#OrdersGrid").data("ejGrid"); 
            var args = { data: e.data, previousData: e.previousData, foreignKeyData: e.foreignKeyData, dropDownModel: dropDownModel };//pass the Id value as event argument 
            obj._trigger("endEdit", args); 
        } 
 
protected void EditEvents_ServerEditRow(object sender, GridEventArgs e) 
        { 
            var dropDataModel = e.Arguments["dropDownModel"];//returns the id of the selected dropdownlist item 
            EditAction(e.EventType, e.Arguments["data"]); 
        } 

Regards, 
Ragavee U S. 


Pratheep
Replied On July 5, 2016 05:30 AM UTC

Hi

Working fine, Thanks

Pratheep

Prasanna Kumar Viswanathan [Syncfusion]
Replied On July 6, 2016 04:09 AM UTC

Hi Pratheep,
 
We are happy that the provided solution working fine at your end.
 
Regards,
 
Prasanna Kumar N.S.V

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;