protected void drpParameterType_SelectedIndexChanged(object sender, EventArgs e) { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@OPR", "74"), new SqlParameter("@ParameterName", txtParameterName.Text), new SqlParameter("@ParameterType", drpParameterType.SelectedValue), new SqlParameter("@CreatedBy", txtCreatedBy.Text) }; if (drpParameterType.SelectedIndex == 0) { param = new SqlParameter[] { new SqlParameter("@OPR", "74"), new SqlParameter("@ParameterName", txtParameterName.Text), new SqlParameter("@CreatedBy", txtCreatedBy.Text) }; } DataTable Dt = new DataTable(); Dt = DBClass.GetDatatable_WithParam(param, "DM_SP_GET_DATA"); GrdParameterList.DataSource = Dt; GrdParameterList.DataBind(); }
protected void BtnShow_Click(object sender, EventArgs e) { bool parameterTypeIsNull = false; try { if (string.IsNullOrEmpty(txtParameterName.Text) && drpParameterType.SelectedIndex == 0 && string.IsNullOrEmpty(txtCreatedBy.Text)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "javascript:alert('Please select/Enter atleast one field')", true); } else { if (drpParameterType.SelectedIndex == 0) { parameterTypeIsNull = true; drpParameterType.Items.RemoveAt(0); drpParameterType.Items.Insert(0, new ListItem("0")); drpParameterType.SelectedValue = "0"; } SqlParameter[] param = new SqlParameter[] { new SqlParameter("@OPR", "74"), new SqlParameter("@ParameterName", txtParameterName.Text), new SqlParameter("@ParameterType", drpParameterType.SelectedValue), new SqlParameter("@CreatedBy", txtCreatedBy.Text) }; DataTable Dt = new DataTable(); Dt = DBClass.GetDatatable_WithParam(param, "DM_SP_GET_DATA"); GrdParameterList.DataSource = Dt; GrdParameterList.DataBind(); if (Dt.Rows.Count > 0) { if (parameterTypeIsNull) { drpParameterType.Items.RemoveAt(0); drpParameterType.Items.Insert(0, new ListItem("Select Parameter Type")); } } else if (Dt.Rows.Count == 0) { if (parameterTypeIsNull) { drpParameterType.Items.RemoveAt(0); drpParameterType.Items.Insert(0, new ListItem("Select Parameter Type")); } } } } catch (Exception ex) { _logger.Error(string.Concat("BindCompletedParametersGrid::", ex.Message), ex); } }
protected void btnExport_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename = QC_Parameter.xls"); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); GrdParameterList.AllowPaging = false; GetData(); GrdParameterList.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); }
protected void btnExport_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename = QC_Parameter.xls"); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); GrdParameterList.AllowPaging = false; GetData(); foreach (GridViewRow row in GrdParameterList.Rows) { (GrdParameterList.Rows[row.RowIndex].Cells[0].FindControl("lnkParameterName") as LinkButton).Enabled = false; } GrdParameterList.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); }
protected void GetData() { try { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@OPR", 22), }; DataTable Dt = new DataTable(); Dt = DBClass.GetDatatable_WithParam(param, "DM_SP_GET_DATA"); GrdParameterList.DataSource = Dt; GrdParameterList.DataBind(); } catch (Exception ex) { _logger.Error(string.Concat("GetData::", ex.Message), ex); } }