private void bindCalibrationSchGrd(int custId) { try { string searchValue = txtsearchValue.Text.Trim(); searchValue = Regex.Replace(searchValue, @"\s+", " "); string stprocedure = "spCalibrationScheduledetails"; DataTable dt = new DataTable(); if (ddlsortby.SelectedItem.Text == "--Select--") { DataSet ds = q.ProcdureWith9Param(stprocedure, 1, custId, 0, "", "", "", "", "", ""); dt = ds.Tables[0]; } else if (ddlsortby.SelectedItem.Text == "Gauge Id-Wise") { try { int gaugeId = Convert.ToInt32(searchValue); DataSet ds = q.ProcdureWith9Param(stprocedure, 2, custId, gaugeId, "", "", "", "", "", ""); dt = ds.Tables[0]; } catch (Exception ex) { g.ShowMessage(this.Page, "Gauge Id is accept only numeric value. " + ex.Message); } } else if (ddlsortby.SelectedItem.Text == "Gauge Name-Wise") { DataSet ds = q.ProcdureWith9Param(stprocedure, 3, custId, 0, searchValue, "", "", "", "", ""); dt = ds.Tables[0]; } else if (ddlsortby.SelectedItem.Text == "Gauge Sr.No.-Wise") { DataSet ds = q.ProcdureWith9Param(stprocedure, 4, custId, 0, "", searchValue, "", "", "", ""); dt = ds.Tables[0]; } else if (ddlsortby.SelectedItem.Text == "Manufacture Id-Wise") { DataSet ds = q.ProcdureWith9Param(stprocedure, 5, custId, 0, "", "", searchValue, "", "", ""); dt = ds.Tables[0]; } else if (ddlsortby.SelectedItem.Text == "Gauge Type-Wise") { DataSet ds = q.ProcdureWith9Param(stprocedure, 6, custId, 0, "", "", "", searchValue, "", ""); dt = ds.Tables[0]; } else if (ddlsortby.SelectedItem.Text == "Frequency Type-Wise") { DataSet ds = q.ProcdureWith9Param(stprocedure, 7, custId, 0, "", "", "", "", searchValue, ""); dt = ds.Tables[0]; } else if (ddlsortby.SelectedItem.Text == "Supplier Name-Wise") { DataSet ds = q.ProcdureWith9Param(stprocedure, 8, custId, 0, "", "", "", "", "", searchValue); dt = ds.Tables[0]; } grdCalibrationSchedule.DataSource = dt; grdCalibrationSchedule.DataBind(); checkAuthority(); } catch (Exception ex) { g.ShowMessage(this.Page, ex.Message); } }