You try this:-
In sql table structure :-
Table Name:-User
Name role Password
Rakesh 1 123
Prince 2 123
Now in Default.aspx i am use a text box and one button .
now when we click the button it send the text box value in default2.aspx page.
Syntax is use for redirect to default2.aspx is
Response.Redirect(~/Default2.aspx?uId=" + textbox1.Text);
Now in default2.aspx page we write page_load event
if(!page.ispostback)
{
if(request.querystring["uID"].ToString()!=null)
{
System.Data.SqlClient.Sqlconnection con=new sqlconnection(
System.Data.SqlClient.SqlDataAdapter adapter=new sqldataadapter("Select * from User where Name='" + request.querystring["uID"].ToString() + "'",con);
DataSet ds=new Dataset();
adapter.fill(ds);
GridView1.DataSource=ds.Tables[0];
GridView1.DataBind();
}
else
Response.Write("No query string send");
}
In Default2.aspx i am taken one gridview control.
I hope work this.