I am currently create an web application to load the selected order in the client transaction record by clicking the copy button in the RadGrid. I implement this by getting the id of the order and retrieve the required entity to insert the form.
JS Runtime Error That Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object By using MVVM Model , I preset the blank row to be null in terms of the mapped fields such as consumer ID , order ID , consumer Name , Price and so on .
The Order Reference Id is named as referenceOrder and retrieve the LoadReference to insert the record
I am currently using C# , Visual Studio 2012.
What I want to ask is there any methodology to check if the row is blank before the copy action being executed ?
The below is my code
protected void grdCustomerReport_ItemCommand(object sender, GridCommandEventArgs e)
{
// [Start] Declare Grid and GridData.
RadGrid CurrentGrid = (RadGrid)sender;
GridDataCustomerReport GridSource = PageSource.GrdCustomerReport;
//[End]
if (e.CommandName == "CustomInsert" &&
GridSource.state != GridModelState.Edit)
{
//Add blank row
}
else if (e.CommandName == "DeleteCurrent")
{
//Delete Row
CurrentGrid.Rebind();
}
else if (e.CommandName == "Copy") <--I click the button and retrieve the dataset index
{
//Check if there is empty row ?
int referenceOrder ;
int rowIndex = Convert.ToInt32(e.CommandArgument);
RadComboBox cbo= (RadComboBox) CurrentGrid.Items[rowIndex].FindControl("cboCode");
if (cbo.SelectedIndex > 0 && cbo.SelectedValue != "")
{
referenceOrder = Convert.ToInt32(cbo.SelectedValue);
PageSource.SetOrder(referenceOrder );
LoadReference();
}
else
{
winAlert.RadAlert("<b>" + "Please Select Reference Orderin the Dropdown List" + "</b>.<br />", 330, 100, "", null);
}
}
}