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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

VB Grid Editing / Inserting with Dropdowns

Thread ID:

Created:

Updated:

Platform:

Replies:

146829 Aug 21,2019 12:35 PM UTC Aug 22,2019 01:11 PM UTC ASP.NET MVC 1
loading
Tags: Grid
Ross Woodward
Asked On August 21, 2019 12:35 PM UTC

I'm trying to achieve a nice easy way for a user to edit a grid row. I have 2 cells which are either yes or no (stored as 1 or 0) and 1 cell for a contract ID number and a Contract Name.

I'm using Templates to display yes or no where appropriate and thats working fine.

However, I have a couple of issues :

I can't get the EDIT drop down box to show the current setting yes or no when editing, it defaults to no.

I cant get the Contract Name drop down box to show my list of items, really I only want the contract name drop down to be on Add, I don't want the user to be able to change it during edit.

when I ADD a new record, I dont get the drop down boxes.

I'm for edit I'm using    
gridbuilder.ClientSideEvents(Sub(client) client.ActionBegin("begin").ActionComplete("complete"))
..
..
function complete(args) {

        if (args.requestType == "beginedit")
            {
            var dpDataSource = [{ value: 1, text: 'Yes' }, { value: 0, text: 'No' }];
            $('#SampleGridlnkActive').ejDropDownList({ dataSource: dpDataSource, selectedIndex: 1 }); // set the new dropdown
            $('#SampleGridlnkDefault').ejDropDownList({ dataSource: dpDataSource, selectedIndex: 1 }); // set the new dropdown

        }

and for adding i'm using

    function begin(args) {
        if (args.requestType == "add")
            {
            var dpDataSource = [{ value: 1, text: 'Yes' }, { value: 0, text: 'No' }];
            var dpDataSource2 = @Html.Raw(ViewBag.listJSON);
            $('#SampleGridlnkActive').ejDropDownList({ dataSource: dpDataSource, selectedIndex: 1 }); // set the new dropdown
            $('#SampleGridlnkDefault').ejDropDownList({ dataSource: dpDataSource, selectedIndex: 1 }); // set the new dropdown
            $('#SampleGridconContractName').ejDropDownList({ dataSource: dpDataSource2, selectedIndex: 0 }); // set the new dropdown

        }
        if (args.requestType == "save") {
            //populate the value into conID field
            $('#SampleGridconID').val = $('#SampleGridContractName').val;
        }

    }

my class for the dpDataSource2 has Text and Value not text and value as its a selectlistitem object.

Can anyone help?

Thanks

Ross



Attachment: ToSend_88a4e2ed.zip

Padmavathy Kamalanathan [Syncfusion]
Replied On August 22, 2019 01:11 PM UTC

Hi Ross, 
 
Thanks for contacting Syncfusion Support. 
 
QUERY1: I can't get the EDIT drop down box to show the current setting yes or no when editing, it defaults to no 
 
From your query we understand that you are rendering a column with template, and based on the dataSource, it should be set to yes or no. But in your application, it get set to “no” irrespective of the value in dataSource. We have validated your issue. We have created a sample. It works fine. We are unable to reproduce the reported issue at our end.  
 
Please refer the sample in the below location, 
 
Please make sure the field value you have given in the template is correct. 
 
Still facing the issue, please reproduce the reported issue in the sample above and share us if possible. 
 
QUERY2: I can’t get the Contract Name drop down box to show my list of items, really I only want the contract name drop down to be on Add, I don't want the user to be able to change it during edit. 
 
From your query we understand that you need to have dropdown for a particular column when you add new record, but while editing, the dropdown should be disabled. 
 
We have already discussed this in our Knowledge Base help documentation. 
 
Please refer the below help documentation, 
 
If we have mis interpreted your queries, please get back to us. 
 
Regards, 
Padmavathy Kamalanathan 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon