Akhter HUssain

Akhter HUssain

  • 1.2k
  • 740
  • 15k

Pass date from gridview to another page textbox

Nov 20 2018 11:56 PM
i have data in a Gridview have Date column when i pass data from gridview to another page using query string by selecting one row ,then date is not getting load in textbox in google chrome browser but it working fine on internet explorer ,kindly guide me.
 
On Gridview i am using this query for selectiong row .
 
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string AID = GridView1.SelectedRow.Cells[1].Text;
Response.Redirect("Daily Attendance.aspx?AID=" + AID);
}
 
on another page i am using this query on page load
 
if (!IsPostBack)
{
String mycon = ("Data Source=DESKTOP-5PJ76B9;Integrated Security=SSPI;Initial Catalog=Institute");
String myquery = "Select AID,Datetime,Outdt,Day,Days,OT,Code from HR3 where AID=" + Request.QueryString["AID"];
SqlConnection con = new SqlConnection(mycon);
SqlCommand cmd = new SqlCommand();
cmd.CommandText = myquery;
cmd.Connection = con;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
TBID.Text = ds.Tables[0].Rows[0]["AID"].ToString();
//TBEN.Text = ds.Tables[0].Rows[0]["EmployeeName"].ToString();
TBIN.Text = ds.Tables[0].Rows[0]["Datetime"].ToString();
TBOut.Text = ds.Tables[0].Rows[0]["Outdt"].ToString();
TBHrs.Text = ds.Tables[0].Rows[0]["Day"].ToString();
TBDay.Text = ds.Tables[0].Rows[0]["Days"].ToString();
TBOT.Text = ds.Tables[0].Rows[0]["OT"].ToString();
TBEID.Text = ds.Tables[0].Rows[0]["Code"].ToString();
}
con.Close();

Answers (3)