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