Pergunta

I am working at a problem in ASP.NET.

I have to create 2 windows (i think that I need to make web forms, i don't know why they said windows) one is the login form, when i press ok and the username and password is ok, I need to
show my second window (webform) How can I do that?

I tried to do

  protected void Button1_Click(object sender, EventArgs e)
        {
            Form2 form = new Form2();
            form.SetFocus("id");
        }

But it gives me error

A form tag with runat=server must exist on the Page to use SetFocus() or the Focus property.

What should I do? Am i right, I have to do separate webforms for thoose windows? This is the picture from the problem that they provided enter image description here

Foi útil?

Solução

If you use webforms you can just use the following code to redirect to second form:

protected void Button1_Click(object sender, EventArgs e)
        {
                 Response.Redirect("Webform2.aspx");
        }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top