I have a webform1 in which I have a textbox sem.Text. Here is the code to pass that
value to a second webform
private string semana_x;
public string semana
{
get
{
return semana_x;
}
set
{
semana_x = value;
this.sem.Text = value;
}
}
protectedvoid b_Click(object sender, EventArgs e)
{
Response.Redirect("webf2.aspx?semana=" + semana);
}
webform 2
//aqui recibo el valor del webf1 y lo convierto a int
int valor;
int.TryParse(Request.QueryString["semana"], out valor);
//para compararlo con un campo de BD
SqlCommand cmd = new SqlCommand("SELECT * from tabla where semana="+valor+",con);
//y mostrar todo en un gridview
SqlDataAdapter da = newSqlDataAdapter(cmd);
DataTable dt = newDataTable();
da.Fill(dt);
gridview1.Visible = true;
gridview1.DataSource = dt;
gridview1.DataBind();
con.Close();
}
The problem is that when I write the number in the texbox it does not show me anything in the table and my
link appears like this: localhost: 49236 / Project / webf2.aspx? week =
but if I add a number at the end
link asi: webf2.aspx? semana = 48 < - asi, and if you show me the data in the gridview
I hope you can help me
Thanks
Greetings