문제

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

도움이 되었습니까?

해결책

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");
        }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top