function openWindow(Date) {
if(Date=="1/1/2018")
{
window.open('FirstPageaspx?Date=' + Date, 'open_window');
}
}
My Firstpage.aspx.cs code as follows
protected void BindGrid1()
{
DataSet ds = new DataSet();
DataTable dt;
DataRow dr;
DataColumn pDate; ;
DataColumn pLocation;
DataColumn pTimein;
DataColumn pTimeout;
DataColumn PHours;
int i = 0;
dt = new DataTable();
pDate = new DataColumn("Date", Type.GetType("System.String"));
pLocation = new DataColumn("Location", Type.GetType("System.String"));
pTimein = new DataColumn("TimeIn", Type.GetType("System.String"));
pTimeout = new DataColumn("TimeOut", Type.GetType("System.String"));
PHours = new DataColumn("WorkingHours", Type.GetType("System.String"));
dt.Columns.Add(pDate);
dt.Columns.Add(pLocation);
dt.Columns.Add(pTimein);
dt.Columns.Add(pTimeout);
dt.Columns.Add(PHours);
dr = dt.NewRow();
dr["Date"] = "1/1/2018";
dr["Location"] = "Chennai";
dr["TimeIn"] = "9.30";
dr["TimeOut"] = "6.30";
dr["WorkingHours"] = "9";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "2/1/2018";
dr["Location"] = "Chennai";
dr["TimeIn"] = "9.30";
dr["TimeOut"] = "7.30";
dr["WorkingHours"] = "10";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "3/1/2018";
dr["Location"] = "Chennai";
dr["TimeIn"] = "10.30";
dr["TimeOut"] = "6.30";
dr["WorkingHours"] = "8";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "4/1/2018";
dr["Location"] = "Chennai";
dr["TimeIn"] = "10.00";
dr["TimeOut"] = "8.00";
dr["WorkingHours"] = "10";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Date"] = "5/1/2018";
dr["Location"] = "Chennai";
dr["TimeIn"] = "9.30";
dr["TimeOut"] = "7.30";
dr["WorkingHours"] = "10";
dt.Rows.Add(dr);
ds.Tables.Add(dt);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
}
protected void BindGrid2()
{
DataSet ds1 = new DataSet();
DataTable dt1;
DataRow dr1;
DataColumn pDate; ;
DataColumn pLocation;
DataColumn pTimein;
DataColumn pTimeout;
DataColumn PHours;
int i = 0;
dt1 = new DataTable();
pDate = new DataColumn("Date", Type.GetType("System.String"));
pLocation = new DataColumn("Location", Type.GetType("System.String"));
pTimein = new DataColumn("TimeIn", Type.GetType("System.String"));
pTimeout = new DataColumn("TimeOut", Type.GetType("System.String"));
PHours = new DataColumn("WorkingHours", Type.GetType("System.String"));
dt1.Columns.Add(pDate);
dt1.Columns.Add(pLocation);
dt1.Columns.Add(pTimein);
dt1.Columns.Add(pTimeout);
dt1.Columns.Add(PHours);
dr1 = dt1.NewRow();
dr1["Date"] = "8/1/2018";
dr1["Location"] = "Chennai";
dr1["TimeIn"] = "9.30";
dr1["TimeOut"] = "6.30";
dr1["WorkingHours"] = "9";
dt1.Rows.Add(dr1);
dr1 = dt1.NewRow();
dr1["Date"] = "9/1/2018";
dr1["Location"] = "Chennai";
dr1["TimeIn"] = "9.30";
dr1["TimeOut"] = "7.30";
dr1["WorkingHours"] = "10";
dt1.Rows.Add(dr1);
dr1 = dt1.NewRow();
dr1["Date"] = "10/1/2018";
dr1["Location"] = "Chennai";
dr1["TimeIn"] = "10.30";
dr1["TimeOut"] = "6.30";
dr1["WorkingHours"] = "8";
dt1.Rows.Add(dr1);
dr1 = dt1.NewRow();
dr1["Date"] = "11/1/2018";
dr1["Location"] = "Chennai";
dr1["TimeIn"] = "10.00";
dr1["TimeOut"] = "8.00";
dr1["WorkingHours"] = "10";
dt1.Rows.Add(dr1);
dr1 = dt1.NewRow();
dr1["Date"] = "12/1/2018";
dr1["Location"] = "Chennai";
dr1["TimeIn"] = "9.30";
dr1["TimeOut"] = "7.30";
dr1["WorkingHours"] = "10";
dt1.Rows.Add(dr1);
ds1.Tables.Add(dt1);
GridView1.DataSource = ds1.Tables[0];
GridView1.DataBind();
}
My code as follows
function openWindow(Date) {
if(Date=="1/1/2018")
{
window.open('FirstPageaspx?Date=' + Date, 'open_window');
}
}
for that how to do.
from my above code i want to do like this if date is 1/1/2018 Call the BindGrid1. suppose if date is 8/1/2018 Call the BindGrid2.
do the above changes in javascript