Dear Sir,
Display page as per calendar holiday using asp.net c#
I am trying to do but it's not working.
namespace hsptl
{
public partial class indx : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.AppendHeader("Refresh", "10");
if (!this.IsPostBack)
{
this.BindGrid();
this.BindGrid1();
//this.BindGrid2();
}
if (DateTime.DATEPART(WEEKDAY,GETDATE(1)));
{
Response.Redirect("/chng_pg.aspx");
}
else
{
Response.Redirect("/indx.aspx");
}
Label2.Text = System.DateTime.Now.ToString("dd/MM/yyyy");
}
private void BindGrid()
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT doc_nm, spl,room,fn,an,rmk FROM aval where isactive='Active' "))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
}
}
}
private void BindGrid1()
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT doc_nm, spl,room,fn,an,rmk FROM vstr_doc where isactive='Active' "))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
GridView2.DataSource = dt;
GridView2.DataBind();
}
}
}
}
}
}
}