Session variable from gridview ? What you try to achieve ?
Can u explain your requirement in detail ?
:)
yes
I have two forms ...one form-gridview ...another oneform have some textbox
in gridview i have three columns....one column is company Name with hyperlink .....if i click one company name it will show that related company details in another form to textbox.....this concept.....
i am doing....selected row put into session ......that session variable compare to another form textbox.....but it not working ....wat can i do...
this is my coding
ingridview
--------------
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
Session["CompanyName"] =GridView1.SelectedRow.Cells[1].Text;
Response.Redirect("Default6.aspx");
}
In nextform
------------------
string str =ConfigurationSettings.AppSettings.Get("connection ");
protected void Page_Load(object sender, EventArgs e)
{
if (TextBox2.Text == "")
{
con = new SqlConnection(str);
cmd = new SqlCommand("SELECT [Company Id], [CompanyName], [Address1], [ContactPerson], [EmailId], [Website] FROM [seller] ", con);
con.Open();
dr = cmd.ExecuteReader();
Response.Write(Session["CompanyName"]);
while (dr.Read())
{
if (Convert.ToString(Session["CompanyName"]) == dr["CompanyName"].ToString())
{
TextBox1.Text = dr["Company Id"].ToString();
TextBox2.Text = dr["CompanyName"].ToString();
TextBox3.Text = dr["Address1"].ToString();
TextBox4.Text = dr["EmailId"].ToString();
TextBox5.Text = dr["Website"].ToString();
TextBox6.Text = dr["ContactPerson"].ToString();
;
}
}
}
}
}