how to send some information from one web form to another web form in asp.net
first web form is HumanList.aspx
that shows the list of humans in a GridView
Say You have a gridview1 with a button field Say "Modify" First Provide a command Name to that field Say "Mod" Now in Gridview1_RowCommand() function of HumanList.aspx page write the code like this-
switch (e.CommandName.Trim())
{
case "Mod":
int r1=Int32.Parse((e.CommandArgument).ToString());
Session["id"]=GridView1.DataKeys[r1].Value.ToString();
Response.Redirect("HumanEdit.aspx?id=" + Session["id"]);
break;
}
Now in HumanEdit.aspx.cs you can make your own class and with in that class you can have a datatable object.Store the Sql query in that object and call that class in page_load(). Say class is
Public void show()
{
Within datatable object you can write your query like this
select x,y,z, from tbl_name where id=" + Request.QueryString["id"]
if(dt.Rows.Count>0)
{
Xtext.Text=dt.Rows[0]["x"].ToString();
Ytext.Text=dt.Rows[0]["y"].ToString();
Ztext.Text=dt.Rows[0]["z"].ToString();
}
}
This much of code is enough to get what you want.