I wan to add calender in text box but its not working
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeFile="main.aspx.cs" Inherits="BGMS.main" %>
<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="2"><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="2"><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;" colspan="2"><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;"><span style="color: #FFFFFF"><strong>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" OnClick="LinkButton1_Click" CssClass="auto-style64" Style="color: #FFFF99">LogOut</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;">
<asp:TextBox ID="TextBox1" runat="server" CssClass="auto-style9" Height="32px" Width="224px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*" ControlToValidate="TextBox1" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</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:DropDownList ID="ddlbg_typ" runat="server" Height="30px" Width="224px" CssClass="auto-style9"></asp:DropDownList>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>NIT No
:</strong></td>
<td style="background-color: #669999; font-size: medium;">
<strong>
<asp:TextBox ID="TextBox3" runat="server" CssClass="auto-style9" Height="32px" Width="224px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="*" ControlToValidate="TextBox3" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>PO No:
</strong>
</td>
<td style="background-color: #669999; font-size: medium;">
<strong>
<asp:TextBox ID="TextBox4" runat="server" CssClass="auto-style9" Height="32px" Width="224px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ErrorMessage="*" ControlToValidate="TextBox4" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</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;">
<strong>
<asp:TextBox ID="TextBox5" runat="server" CssClass="auto-style9" Height="32px" Width="224px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ControlToValidate="TextBox5" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</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>
<script src="js/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/main1.css">
<link href="js/jquery-ui.min.css" rel="stylesheet" />
<asp:TextBox ID="TextBox6" runat="server" Height="29px" Width="220px"></asp:TextBox>
<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: "dd-mm-yy",
changeMonth: true,
changeYear: true,
yearRange: '1950:2050'
});
})
</script>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="*" ControlToValidate="TextBox6" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>BG Expiring Date
:
</strong>
</td>
<td style="background-color: #669999; font-size: medium;">
<strong>
<asp:TextBox ID="TextBox7" runat="server" CssClass="auto-style9" Height="32px" Width="224px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ErrorMessage="*" ControlToValidate="TextBox7" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</strong>
</td>
<td style="background-color: #669999; font-size: medium;"><strong>BG Issuing Bank
:
</strong>
</td>
<td style="background-color: #669999; font-size: medium;">
<strong>
<asp:TextBox ID="TextBox8" runat="server" CssClass="auto-style9" Height="32px" Width="224px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ErrorMessage="*" ControlToValidate="TextBox8" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</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;">
<strong>
<asp:DropDownList ID="ddlbg_rcvd" runat="server" Height="30px" Width="224px" CssClass="auto-style9"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="*" ControlToValidate="ddlbg_rcvd" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</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:DropDownList ID="ddlbg_rcvd_whm" runat="server" Height="30px" Width="224px" CssClass="auto-style9"></asp:DropDownList>
</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;">
<strong>
<asp:TextBox ID="TextBox11" runat="server" CssClass="auto-style9" Height="32px" Width="224px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ErrorMessage="*" ControlToValidate="TextBox11" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</strong>
</td>
<td style="background-color: #669999"> </td>
<td style="background-color: #669999"> </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;">
<strong>
<asp:TextBox ID="TextBox13" runat="server" CssClass="auto-style9" Height="32px" Width="224px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*" ControlToValidate="TextBox13" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</strong>
</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"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="*" ControlToValidate="TextBox14" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</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;">
<strong>
<asp:TextBox ID="TextBox15" runat="server" CssClass="auto-style9" Height="32px" Width="224px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ErrorMessage="*" ControlToValidate="TextBox15" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</strong>
</td>
<td style="background-color: #669999"> </td>
<td style="background-color: #669999"><span class="auto-style5"><span class="auto-style9">
<asp:FileUpload ID="FileUpload1" runat="server" />
</span></span>
</td>
<td style="background-color: #669999">
<asp:Literal ID="ltEmbed" runat="server" /></td>
</tr>
<tr>
<td style="background-color: #669999; font-size: medium;">
<strong>Action Pending: </strong>
</td>
<td style="background-color: #669999; font-size: medium;">
<strong>
<asp:TextBox ID="TextBox12" runat="server" CssClass="auto-style9" Height="32px" Width="224px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="*" ControlToValidate="TextBox12" Style="color: #FF0000"> </asp:RequiredFieldValidator>
</strong>
</td>
<td style="background-color: #669999" colspan="4">
<strong>
<span class="auto-style5"><span class="auto-style9">
</span></span></td>
<td colspan="3" style="background-color: #669999">
<asp:Label ID="Label5" runat="server" Text="label"></asp:Label>
</td>
</tr>
<tr>
<td style="background-color: #669999" colspan="2"> </td>
<td style="background-color: #669999; font-size: medium;" colspan="4" class="text-center">
<strong>
<asp:Button ID="Button1" runat="server" Text="Save" Height="29px" Width="114px" OnClick="Button1_Click" CausesValidation="true" />
<asp:Button ID="Button2" runat="server" Text="Cancel" Height="29px" Width="114px" />
</td>
<td colspan="3" style="background-color: #669999" class="text-center"> </td>
</tr>
<tr>
<td class="auto-style9" colspan="9" style="text-align: center"><strong>Summary</strong><span class="auto-style5"><span class="auto-style9"></span></span></td>
</tr>
<tr>
<td class="auto-style9" colspan="9">
<asp:GridView ID="GridView1"
HeaderStyle-BackColor="#99ccff"
HeaderStyle-ForeColor="black"
DataKeyNames="Id"
runat="server" Font-Size="Medium" AutoGenerateColumns="False"
HeaderStyle-Font-Size="16px"
OnRowCommand="GridView1_RowCommand" OnRowDataBoub="GridView1_RowDataBound"
EmptyDataText="There are no any BGMS pending.."
Height="100px" Width="1900px"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating"
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:BoundField DataField="bg_exp_dt" HeaderText="BG Expiring Date" />
<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="actn_pnding" HeaderText="Action Pending" />
<asp:BoundField DataField="schdle_dt" HeaderText="Scheduled Del Dt" />
<asp:BoundField DataField="prcnt_dlvry" HeaderText="% Delivered" />
<asp:BoundField DataField="fnl_dlvry_dt" HeaderText="Date of Final Delivery" />
<asp:TemplateField HeaderText="View">
<ItemTemplate>
<asp:Button ID="LinkButton1" Text="View" runat="server" CommandName="EditButton" CausesValidation="false" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" />
</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>
</span></span>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
</asp:Content>
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;
using System.Reflection.Emit;
namespace BGMS
{
public partial class main : System.Web.UI.Page
{
string cs = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlConnection con;
SqlDataAdapter adapt;
DataTable dt;
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindGrid();
if (Session["EMP_NAME"] == null)
Response.Redirect("lgn.aspx");
else
{
String EmplooyeId = Session["emp_id"].ToString();
Label1.Text = " " + EmplooyeId + "";
String emp_nm = Session["EMP_NAME"].ToString();
Label2.Text = "" + emp_nm + " ";
String emp_dsg = Session["EMP_DSG"].ToString();
Label3.Text = "" + emp_dsg + " ";
String dept = Session["DEPT_ID"].ToString();
Label4.Text = "" + dept + " ";
}
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT Id, bg_type FROM bg_typ"))
{
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
ddlbg_typ.DataSource = cmd.ExecuteReader();
ddlbg_typ.DataTextField = "bg_type";
ddlbg_typ.DataValueField = "bg_type";
ddlbg_typ.DataBind();
con.Close();
}
}
ddlbg_typ.Items.Insert(0, new ListItem("--Select BG type--", "0"));
string constr1 = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr1))
using (SqlCommand cmd = new SqlCommand("SELECT Id, bg_rcvd FROM bg_rcvd"))
{
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
ddlbg_rcvd.DataSource = cmd.ExecuteReader();
ddlbg_rcvd.DataTextField = "bg_rcvd";
ddlbg_rcvd.DataValueField = "bg_rcvd";
ddlbg_rcvd.DataBind();
con.Close();
}
ddlbg_rcvd.Items.Insert(0, new ListItem("--Select Media--", "0"));
string constr2 = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr2))
using (SqlCommand cmd = new SqlCommand("SELECT Id, bg_rcvd_whm FROM bg_rcvd_whm"))
{
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
ddlbg_rcvd_whm.DataSource = cmd.ExecuteReader();
ddlbg_rcvd_whm.DataTextField = "bg_rcvd_whm";
ddlbg_rcvd_whm.DataValueField = "bg_rcvd_whm";
ddlbg_rcvd_whm.DataBind();
con.Close();
}
ddlbg_rcvd_whm.Items.Insert(0, new ListItem("--Select Name--", "0"));
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("lgn.aspx");
}
protected void Button1_Click(object sender, EventArgs e)
{
string cs = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlConnection con = new SqlConnection(cs);
SqlCommand cmd = new SqlCommand("INSERT INTO bgms (emp_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) VALUES('" + Label1.Text + "','" + TextBox1.Text + "','" + ddlbg_typ.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + ddlbg_rcvd.Text + "','" + ddlbg_rcvd_whm.Text + "','" + TextBox11.Text + "','" + TextBox12.Text + "','" + TextBox13.Text + "','" + TextBox14.Text + "','" + TextBox15.Text + "')", con);
cmd.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output;
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);
}
private void BindGrid()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString);
// SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM vstr2 WHERE EMP_ID=" + Session["emp_id"] + " and is_vstd='No'", con);
// SqlDataAdapter sda = new SqlDataAdapter("SELECT Id, vst_nm, idtyp,idnm,fa_hu_nm,gndr,crnt_add,vstd_dt,pur_pos,phn,cisf_in_flag FROM vstr2 WHERE EMP_ID=" + Session["emp_id"] + " and is_vstd='No'", con);
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 FROM bgms WHERE EMP_ID=" + Session["emp_id"] + "", con);
DataTable dt = new DataTable();
sda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void GridView1_RowCancelingEdit(object sender, System.Web.UI.WebControls.GridViewCancelEditEventArgs e)
{
}
protected void GridView1_RowEditing(object sender, System.Web.UI.WebControls.GridViewEditEventArgs e)
{
}
protected void GridView1_RowUpdating(object sender, System.Web.UI.WebControls.GridViewUpdateEventArgs e)
{
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "EditButton")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
// Response.Redirect("vw.aspx?Id=" + row.Cells[0].Text + "&EMP_ID=" + Label1.Text + "&EMP_NAME=" + Label2.Text + "&DEPT_ID=" + Label3.Text);
Response.Redirect("vw.aspx?Id=" + row.Cells[0].Text);
//Response.Redirect("vw.aspx?id=" + txtId.Text + "&name=" + txtName.Text + "&desig=" + txtDesig.Text);
}
}
}
}