protected void chkCheck_CheckedChanged(object sender, EventArgs e) { CheckBox chk = (CheckBox)sender; GridViewRow gr = (GridViewRow)chk.Parent.Parent; //Label1.Text = gr.Cells[1].Text; gr.Focus(); // qry = "Exec Jct_Payroll_Compensatory_Attendance_Match '" + gr.Cells[1].Text + "'"; string SqlPass = null; if (chk.Checked == false) { GridView1.DataSource = null; GridView1.DataBind(); return; } else { if (DrpLvStatus.SelectedItem.Value.ToLower() == "reimbursements") { Response.Redirect("~/ReimUploaddocCheck.aspx?ecode=" + Convert.ToInt64(gr.Cells[10].Text)); //Convert.ToInt64(gr.Cells[10].Text); } } if (Session["Empcode"].ToString() == "9000000350" || Session["Empcode"].ToString() == "9000000075") { SqlCommand Cmd = new SqlCommand(); SqlPass = "******"; Cmd = new SqlCommand(SqlPass, obj.Connection()); Cmd.CommandType = CommandType.StoredProcedure; Cmd.Parameters.Add("@Autoid", SqlDbType.BigInt).Value = Convert.ToInt64(gr.Cells[1].Text); SqlDataAdapter Da = new SqlDataAdapter(Cmd); DataSet ds = new DataSet(); Da.Fill(ds); if (ds.Tables.Count == 0) { GridView1.DataSource = null; GridView1.DataBind(); string script = "alert('No Record Found');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "ServerControlScript", script, true); return; } else { GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } //Label1.Text = GridView1.DataKeys[gr.RowIndex].Value.ToString(); } }
protected void GrdViewRight_CheckedChanged(object sender, EventArgs e) { CheckBox chkViewRight = (CheckBox)sender; GridViewRow dr = (GridViewRow)chkViewRight.Parent.Parent; dr.Focus(); if (chkViewRight.Checked == false) { ((CheckBox)dr.FindControl("GrdDelRight")).Checked = false; ((CheckBox)dr.FindControl("GrdEditRight")).Checked = false; ((CheckBox)dr.FindControl("GrdPrintRight")).Checked = false; ((CheckBox)dr.FindControl("GrdDelRight")).Enabled = false; ((CheckBox)dr.FindControl("GrdEditRight")).Enabled = false; ((CheckBox)dr.FindControl("GrdPrintRight")).Enabled = false; } else { ((CheckBox)dr.FindControl("GrdDelRight")).Enabled = true; ((CheckBox)dr.FindControl("GrdEditRight")).Enabled = true; ((CheckBox)dr.FindControl("GrdPrintRight")).Enabled = true; } }