I have a RadGrid with 3 external filter controls: 1 textbox and 2 comboboxes. Things work well when the requested data from these controls is successfully returned by the GetData() query. However, if I try to return an incorrect value from one of the controls my app blows-up stating that I have no bindable data. How can I create a scenario from which it checks to see if my DataTable returns rows and if NOT, then display a pop-up message AND to not re-bind the RadGrid? Here is my current code ...
My controls include: RadGrid1, RadComboBox1, RadComboBox2, RadTextBox1, DataTable = myDataTable, DataRows = rows.
My controls include: RadGrid1, RadComboBox1, RadComboBox2, RadTextBox1, DataTable = myDataTable, DataRows = rows.
if (condition) {rows =...}else if (condition) {rows = ...} else{return new DataTable();} if (myDataTable.Rows.Count == 0){ClientScript.RegisterStartupScript(this.GetType(), "norowalert", "alert('I cannot complete your request.\nThere are no records that meet your criteria.');", true);return new DataTable();}if (rows.Length == 0){ClientScript.RegisterStartupScript(this.GetType(), "norowalert", "alert('I cannot complete your request.\nThere are no records that meet your criteria.');", true);return new DataTable(); }if (rows.Length >= 1){return rows.CopyToDataTable();RadGrid1.DataBind();}return rows.CopyToDataTable();}