Pass the value of a Label to another aspx page with c #

0

How can I pass a Label variable that stores a name to another aspx page called Registers? I open the Records page by means of a button like a pop-up window:

 protected void Ver_Click(object sender, EventArgs e)
{
    string vtn = "window.open('VerDetalle.aspx','Dates','scrollbars=yes,resizable=yes','height=90', 'width=50')";
    ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", vtn, true);
}

For that reason I do not intend to use Response.Redirect. Could you help me with some other form?

    
asked by Elizabeth 26.06.2018 в 17:16
source

1 answer

1

I would recommend that if you are going to get a value from the page, never take it from a label, if you want to show it is fine, but also assign the value to a hidden of asp.net, so you can take it when the post

protected void Ver_Click(object sender, EventArgs e)
{
    var valor = Hidden1.Value;
    string url = string.Format("'VerDetalle.aspx?keyname={0}'", valor);

    string vtn = "window.open(url,'Dates','scrollbars=yes,resizable=yes','height=90', 'width=50')";

    ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", vtn, true);
} 

On page VerDetalle.aspx you will use

var valor = Request.QueryString["keyname"];

to get the value you send in the url

    
answered by 26.06.2018 / 19:33
source