I am trying to add a new row on the client side using through a function when a user clicks a button. I keep getting and error "Async request failed [InvalidCastException]: Specified cast is not valid. Why am I getting this error? I have tried inserting using an integer and a string and still no luck. Also, I have tried to insert a new row without setting the first element of the array and I receive an error that the datakeyfield is null. The first element of my array is the DataKeyField and that Bound column is using a dropdownprovider.
function add() {
var grid = $find('<%= _ultraGridEmployees.ClientID %>')
var DropdownList = document.getElementById('<%=ddlPayType.ClientID %>');
var SelectedIndex = DropdownList.selectedIndex;
var SelectedValue = DropdownList.options[DropdownList.selectedIndex].value;
var SelectedText = DropdownList.options[DropdownList.selectedIndex].text;
var rows = grid.get_rows();
var newRow = new Array(grid.get_columns().get_length()); // create a new empty row
newRow[0] = SelectedValue;
rows.add(newRow);
}
Please advise.
Thanks!
Thanks for your help!!!
Hello,If you have any other questions do not hesitate to ask us.