Dear Sir,
Please help me for adding valition of
if Action Pending='No' then PBG BG to be released='Yes' how to add validation in RadioButton select event
.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" Codefile="PBG.aspx.cs" Inherits="BGMS.PBG" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"></asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
<table border="2" CssClass="auto-style53" Height="500px" Width="1900px" CssClass="auto-style53" align="center" >
<tr>
<td style="font-weight: bold; background-color: #003366; font-size: large;" colspan="3"><span style="color: #FFFFFF"><b><span class="auto-style5" style="font-size: large"><strong>Emp. Id:<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></strong></span></b></td>
<span class="auto-style9">
<td style="background-color: #003366; font-size: large;" colspan="2"><span style="color: #FFFFFF"><b><strong>Emp.Name:<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label></strong></b></td>
<td style="background-color: #003366; font-size: large;" colspan="3"><span style="color: #FFFFFF"><b><strong>Designation:<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label></strong></b></td>
<td style="background-color: #003366; font-size: large; width: 148px;"><span style="color: #FFFFFF"><b><strong>Deptt.:<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label></strong></b></span></td>
<td style="background-color: #003366; font-size: large; width: 148px; color: #FFFFFF;" colspan="2"><strong>BGMS ID :<asp:Label ID="Label5" runat="server" Text="Label"></asp:Label></strong></td>
<td style="background-color: #003366; font-size: large;"><span style="color: #FFFFFF"><strong><asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" OnClick="LinkButton1_Click" CssClass="auto-style64" style="color: #FFFF99">Back</asp:LinkButton></strong></td>
</tr>
</span><span class="auto-style5"><span class="auto-style9">
<tr>
<td style="background-color: #669999">
<span class="auto-style9"><strong>Agency Name :
</strong></span></span>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;" colspan="2">
<strong>
<asp:TextBox ID="TextBox1" runat="server" CssClass="auto-style9" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;">
<strong>Type of BG :
</strong>
</td>
<td style="background-color: #669999; font-size: medium;">
<strong>
<asp:TextBox ID="TextBox2" runat="server" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>NIT No:</strong></td>
<td style="background-color: #669999; font-size: medium; width: 172px;" colspan="2">
<strong><asp:TextBox ID="TextBox3" runat="server" CssClass="auto-style9" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>PO No: </strong></td>
<td style="background-color: #669999; font-size: medium;" colspan="2">
<strong>
<asp:TextBox ID="TextBox4" runat="server" CssClass="auto-style9" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999"> </td>
</tr>
<tr>
<td style="background-color: #669999; font-size: medium;"><strong>BG No:</strong></td>
<td style="background-color: #669999; font-size: medium;" colspan="2">
<strong>
<asp:TextBox ID="TextBox5" runat="server" CssClass="auto-style9" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999"><span class="auto-style9"><strong>BG Issued Date:
</strong></span>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
<script>
$(document).ready(function () {
$('#TextBox6').datepicker({
dateFormat: "yy-mm-dd",
changeMonth: true,
changeYear: true,
yearRange: '1950:2050'
});
})
</script>
</td>
<td style="background-color: #669999; font-size: medium;">
<strong>
<asp:TextBox ID="TextBox6" runat="server" CssClass="auto-style9" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>BG Expiring Date:</strong>
</td>
<td style="background-color: #669999; font-size: medium; width: 172px;" colspan="2">
<strong>
<asp:TextBox ID="TextBox7" runat="server" CssClass="auto-style9" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>BG Issuing Bank:</strong>
</td>
<td style="background-color: #669999; font-size: medium;" colspan="2">
<strong>
<asp:TextBox ID="TextBox8" runat="server" CssClass="auto-style9" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999"> </td>
</tr>
<tr>
<td style="background-color: #669999; font-size: medium;"><strong>BG Received Media:</strong></td>
<td style="background-color: #669999; font-size: medium;" colspan="2">
<strong> <asp:TextBox ID="TextBox9" runat="server" CssClass="auto-style9" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox></strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>1st Received by whom:</strong></td>
<td style="background-color: #669999; font-size: medium;">
<strong><asp:TextBox ID="TextBox10" runat="server" CssClass="auto-style9" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>BG Handed Over to:</strong></td>
<td style="background-color: #669999; font-size: medium; width: 172px;" colspan="2">
<strong><asp:TextBox ID="TextBox11" runat="server" CssClass="auto-style9" Height="32px" Width="224px" ReadOnly="true" BorderStyle="None" ForeColor="green" style="color: #FFFFFF; background-color: #669999"></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"> </td>
<td style="background-color: #669999; font-size: medium;" colspan="2" >
</td>
<td style="background-color: #669999"></td>
<tr>
<td style="background-color: #669999; font-size: medium;"><strong>Scheduled Del Dt:</strong></td>
<td style="background-color: #669999; font-size: medium;" colspan="2">
<strong><asp:TextBox ID="TextBox13" runat="server" CssClass="auto-style9" placeholder="---Select Date---" Height="32px" Width="224px" BorderStyle="None" ></asp:TextBox>
</strong>
<script src="js/jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function () {
$('[id*=TextBox13]').datepicker({
dateFormat: "dd-mm-yy",
changeMonth: true,
changeYear: true,
yearRange: '1950:2050'
});
})
</script>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>% Delivered: </strong></td>
<td style="background-color: #669999; font-size: medium;">
<strong>
<asp:TextBox ID="TextBox14" runat="server" CssClass="auto-style9" Height="32px" Width="224px" BorderStyle="None" ></asp:TextBox>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>Date of Final Delivery:</strong></td>
<td style="background-color: #669999; font-size: medium; width: 172px;" colspan="2">
<strong>
<asp:TextBox ID="TextBox15" runat="server" CssClass="auto-style9" Height="32px" Width="224px" placeholder="---Select Date---" BorderStyle="None" ></asp:TextBox>
</strong>
<script src="js/jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function () {
$('[id*=TextBox15]').datepicker({
dateFormat: "dd-mm-yy",
changeMonth: true,
changeYear: true,
yearRange: '1950:2050'
});
})
</script>
</td>
<td style="background-color: #669999; font-weight: bold; font-size: medium;"></td>
<td style="background-color: #669999; font-weight: bold;"> </td>
<script src="js/jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function () {
$('[id*=TextBox12]').datepicker({
dateFormat: "dd-mm-yy",
changeMonth: true,
changeYear: true,
yearRange: '1950:2050'
});
})
</script>
<td style="background-color: #669999; font-weight: bold;"></td>
<td style="background-color: #669999"></td>
</tr>
<tr>
<td style="background-color: #669999; font-size: medium;"><strong>Is Partial Delivery:</strong></td>
<td style="background-color: #669999; font-size: medium;">
<strong> <asp:DropDownList ID="ddlprtdlvry" runat="server"
Height="32px" Width="224px"
AutoPostBack="true" OnSelectedIndexChanged="DropDownList_Changed" >
<asp:ListItem Text="No" Value="No" />
<asp:ListItem Text="Yes" Value="Yes" />
</asp:DropDownList>
</strong></td>
<asp:Panel ID="pnlTextBox" runat="server" Visible="false">
<td style="background-color: #669999; font-size: medium;">
<strong><asp:Label ID="Label6" runat="server" Text="Partial Delivery date :" style="background-color: #669999; font-size: medium;" Height="32px" Width="224px"></asp:Label></strong>
<td style="background-color: #669999; font-size: medium;">
<asp:TextBox ID="prtldilvrydt" runat="server" CssClass="auto-style9" placeholder="---Select Date---" Height="32px" Width="224px" BorderStyle="None" ></asp:TextBox>
<script src="js/jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function () {
$('[id*=prtldilvrydt]').datepicker({
dateFormat: "dd-mm-yy",
changeMonth: true,
changeYear: true,
yearRange: '1950:2050'
});
})
</script>
</asp:Panel>
<td style="background-color: #669999; font-size: medium;"><span class="auto-style5"><span class="auto-style9"></td>
<td style="background-color: #669999; font-size: medium; text-align: center;" colspan="2"> </td>
<td style="background-color: #669999; font-weight: bold; font-size: medium; text-align: center;"></td>
<td style="background-color: #669999; font-weight: bold; text-align: center;"></td>
<td style="background-color: #669999; font-weight: bold;"> </td>
<td style="background-color: #669999"></td>
<td style="background-color: #669999"></td>
<td style="background-color: #669999"></td>
<td style="background-color: #669999"></td>
</tr>
<tr>
<td style="background-color: #669999" rowspan="3"> </td>
<td style="background-color: #669999" rowspan="3"> </td>
<td style="background-color: #669999" rowspan="3"> </td>
<td style="background-color: #669999" colspan="2" rowspan="3">
<strong>
<span class="auto-style5"><span class="auto-style9"> <asp:Button ID="Button1" runat="server" Text="Save" Height="29px" Width="114px" OnClick="Button1_Click" /> <asp:Button ID="Button2" runat="server" Text="Cancel" Height="29px" Width="114px" OnClick="Button2_Click" />
</span></span>
</td>
<td style="background-color: #669999" rowspan="3">
</td>
<td style="background-color: #CC9900; font-size: medium; font-weight: bold;" class="text-center">
<strong>Action Pending:</strong><b> </b>
</td>
<td style="background-color: #CC9900; font-size: medium; font-weight: bold;" colspan="2" class="text-center">
<b><asp:RadioButton ID="apYes" Text="Yes" runat="server" GroupName="action_pndng" /></b></td>
<td style="background-color: #CC9900" font-size: medium; font-weight: bold;" colspan="2" class="text-center"><b><asp:RadioButton ID="apNo" Text="No" runat="server" GroupName="action_pndng" /></b></td>
<td style="background-color: #669999" rowspan="3"> </td>
<td style="background-color: #669999" rowspan="3"> </td>
<tr>
<td style="background-color: #CC9900; font-size: medium; font-weight: bold;" class="text-center">
PBG BG to be released:</td>
<td style="background-color: #CC9900; font-size: medium; font-weight: bold;" colspan="2" class="text-center">
<b> <asp:RadioButton ID="rbYes" Text="Yes" runat="server" GroupName="released" style="text-align: left" /></b></td>
<td style="background-color: #CC9900" font-size: medium; font-weight: bold;" colspan="2" class="text-center"> <b> <asp:RadioButton ID="rbNo" Text="No" runat="server" GroupName="released" /></b></td>
<tr>
<td style="background-color: #CC9900; font-size: medium; font-weight: bold;" colspan="5" class="text-center">
( If % Delivery >=100%, Action Pending = NO, PBG BG to be released =Yes("PBG to be released after "Final date of delivery+18 months) )</td>
</tr>
<tr>
<td style="background-color: #669999" rowspan="2" colspan="12">
<asp:GridView ID="GridView1"
HeaderStyle-BackColor="#99ccff"
HeaderStyle-ForeColor="black"
DataKeyNames="Id"
runat="server" Font-Size="Medium" AutoGenerateColumns="False"
HeaderStyle-Font-Size="16px"
EmptyDataText="There are no any BGMS pending.."
Height="100px" Width="1900px"
CssClass="auto-style56" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3">
<Columns>
<asp:BoundField DataField="Id" HeaderText="BGMS id" />
<asp:BoundField DataField="agncy_nm" HeaderText="Agency Name " />
<asp:BoundField DataField="bg_typ" HeaderText="Type of BG" />
<asp:BoundField DataField="nit_no" HeaderText="NIT No" />
<asp:BoundField DataField="po_no" HeaderText="PO No" />
<asp:BoundField DataField="bg_no" HeaderText="BG No" />
<asp:BoundField DataField="bg_issue_dt" DataFormatString="{0:dd-MM-yyyy}" HeaderText="BG Issued Date" />
<asp:TemplateField HeaderText="BG Expiring Date">
<ItemTemplate>
<asp:Label ID="lblDate" Text='<%# Eval("bg_exp_dt") %>' runat="server" />
</ItemTemplate>
<ItemStyle Width="200px"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="bg_issu_bnk" HeaderText="BG Issuing Bank" />
<asp:BoundField DataField="bg_rcv_midia" HeaderText="BG Received Media" />
<asp:BoundField DataField="frst_rcv_whom" HeaderText="1st Received by whom" />
<asp:BoundField DataField="bg_hnd_ovr" HeaderText="BG Handed Over to" />
<asp:BoundField DataField="schdle_dt" HeaderText="Scheduled Del Dt" />
<asp:BoundField DataField="fnl_dlvry_dt" HeaderText="Date of Final Delivery" />
<asp:BoundField DataField="prcnt_dlvry" HeaderText="% Delivered" />
<asp:BoundField DataField="actn_pnding" HeaderText="Action Pending" />
<asp:BoundField DataField="released" HeaderText="BG Released" />
<asp:BoundField DataField="is_prtl_dlvry" HeaderText="Is Partial Delivery" />
<asp:BoundField DataField="prtl_dlvry_dt" HeaderText="Partial Delivery date" />
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<asp:Button ID="Button3" Text="Closed" runat="server" CausesValidation="false" CommandName="Closed" OnClientClick="return confirm('Are you sure you want to mark as Closed this BG ?');" OnClick="Closed" CommandArgument="<%# Container.DataItemIndex %>" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
</td>
</tr>
</table>
<span class="auto-style9"><strong>
</strong></span>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/themes/start/jquery-ui.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js"></script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
</asp:Content>
.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection.Emit;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace BGMS
{
public partial class PBG : System.Web.UI.Page
{
int empno = 0;
protected void Page_Load(object sender, EventArgs e)
{
empno = Convert.ToInt32(Request.QueryString["Id"].ToString());
// Session["EMP_ID"] = empno;
String EMP_ID = Session["EMP_ID"].ToString();
Label1.Text = " " + EMP_ID + "";
String emp_nm = Session["EMP_NAME"].ToString();
Label2.Text = "" + emp_nm + " ";
String EMP_DSG = Session["DEPT_ID"].ToString();
Label4.Text = "" + EMP_DSG + " ";
String dept = Session["EMP_DSG"].ToString();
Label3.Text = "" + dept + " ";
if (!IsPostBack)
{
BindTextBoxvalues();
this.BindGrid();
}
foreach (GridViewRow row in GridView1.Rows)
{
(row.FindControl("Button3") as Button).Visible = true;
if (row.Cells[14].Text == "100%" & row.Cells[15].Text == "No" & row.Cells[16].Text == "Yes")
{
(row.FindControl("Button3") as Button).Visible = true;
}
else
{
(row.FindControl("Button3") as Button).Visible = false;
}
}
}
protected void DropDownList_Changed(object sender, EventArgs e)
{
if (ddlprtdlvry.SelectedItem.Value == "Yes")
{
pnlTextBox.Visible = true;
}
else
{
pnlTextBox.Visible = false;
}
}
private void BindTextBoxvalues()
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand("select * from bgms where Id=" + empno, con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
Label5.Text = dt.Rows[0][0].ToString();
TextBox1.Text = dt.Rows[0][2].ToString();
TextBox2.Text = dt.Rows[0][3].ToString();
TextBox3.Text = dt.Rows[0][4].ToString();
TextBox4.Text = dt.Rows[0][5].ToString();
TextBox5.Text = dt.Rows[0][6].ToString();
TextBox6.Text = dt.Rows[0][7].ToString();
TextBox7.Text = dt.Rows[0][8].ToString();
TextBox8.Text = dt.Rows[0][9].ToString();
TextBox9.Text = dt.Rows[0][10].ToString();
TextBox10.Text = dt.Rows[0][11].ToString();
TextBox11.Text = dt.Rows[0][12].ToString();
//TextBox12.Text = dt.Rows[0][13].ToString();
TextBox13.Text = dt.Rows[0][14].ToString();
TextBox14.Text = dt.Rows[0][15].ToString();
TextBox15.Text = dt.Rows[0][16].ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
string Id = Label5.Text.Trim();
string schdle_dt = TextBox13.Text.Trim();
string prcnt_dlvry = TextBox14.Text.Trim();
string fnl_dlvry_dt = TextBox15.Text.Trim();
string is_prtl_dlvry = ddlprtdlvry.Text.Trim();
string prtl_dlvry_dt = prtldilvrydt.Text.Trim();
string actn_pnding = string.Empty;
if (apYes.Checked)
{
actn_pnding = "Yes";
}
else if (apNo.Checked)
{
actn_pnding = "No";
}
string released = string.Empty;
if (rbYes.Checked)
{
released = "Yes";
}
else if (rbNo.Checked)
{
released = "No";
}
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("UPDATE bgms SET schdle_dt=@schdle_dt,prcnt_dlvry=@prcnt_dlvry,fnl_dlvry_dt=@fnl_dlvry_dt,actn_pnding=@actn_pnding,released=@released,is_prtl_dlvry=@is_prtl_dlvry,prtl_dlvry_dt=@prtl_dlvry_dt WHERE Id = @Id"))
{
cmd.Connection = con;
cmd.Parameters.AddWithValue("@Id", Id);
cmd.Parameters.AddWithValue("@schdle_dt", schdle_dt);
cmd.Parameters.AddWithValue("@prcnt_dlvry", prcnt_dlvry);
cmd.Parameters.AddWithValue("@fnl_dlvry_dt", fnl_dlvry_dt);
cmd.Parameters.AddWithValue("@actn_pnding", actn_pnding);
cmd.Parameters.AddWithValue("@released", released);
cmd.Parameters.AddWithValue("@is_prtl_dlvry", is_prtl_dlvry);
cmd.Parameters.AddWithValue("@prtl_dlvry_dt", prtl_dlvry_dt);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
string message = "BG details saved successfully.";
string script = "window.onload = function(){ alert('";
script += message;
script += "');";
script += "window.location = '";
script += Request.Url.AbsoluteUri;
script += "'; }";
ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
}
}
}
protected void Button2_Click(object sender, EventArgs e)
{
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("main.aspx");
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
LinkButton lnkView = sender as LinkButton;
GridViewRow row = lnkView.NamingContainer as GridViewRow;
string urlName = Request.Url.AbsoluteUri;
// Removing the Page Name
urlName = urlName.Remove(urlName.LastIndexOf("/"));
//Adding FolderName and FileName in the URL
string url = string.Format("{0}/img/{1}", urlName, Label5.Text);
string script = "<script type='text/javascript'>window.open('" + url + "')</script>";
this.ClientScript.RegisterStartupScript(this.GetType(), "script", script);
}
private void BindGrid()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString);
SqlDataAdapter sda = new SqlDataAdapter("SELECT Id,agncy_nm, bg_typ, nit_no,po_no,bg_no,bg_issue_dt,bg_exp_dt,bg_issu_bnk,bg_rcv_midia,frst_rcv_whom,bg_hnd_ovr,actn_pnding,schdle_dt,prcnt_dlvry,fnl_dlvry_dt,released,bg_closed,image,is_prtl_dlvry,prtl_dlvry_dt,Date FROM bgms WHERE Id=" + Label5.Text + "and bg_closed='No' ", con);
DataTable dt = new DataTable();
sda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void Closed(object sender, EventArgs e)
{
GridViewRow row = (sender as Button).NamingContainer as GridViewRow;
int Id = Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32((sender as Button).CommandArgument)].Values[0]);
string bg_closed = "YES";
// string mrk_out_emp = DateTime.Now.ToString();
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("UPDATE bgms SET bg_closed = @bg_closed WHERE Id = @Id"))
{
cmd.Parameters.AddWithValue("@Id", Id);
// cmd.Parameters.AddWithValue("@emp_out_flag", emp_out_flag);
cmd.Parameters.AddWithValue("@bg_closed", bg_closed);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
GridView1.EditIndex = -1;
row.Visible = false;
}
}
}
}
}