3 Replies - 687 Views - Last Post: 21 January 2012 - 08:17 AM Rate Topic: -----

Topic Sponsor:

#1 lashy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 20-January 12

Visual Studio - c# - switching Webforms

Posted 20 January 2012 - 11:36 AM

Hi,

Started learning c# with visual studio 2008 this week so apologies for this question but i dont think im searching for the correct thing.

I am making a simple c# aspx website that users/admin place and edit issues to an sql databases. This now works with a datagrid (default.aspx) from seaching here and internet for the code, so a big thanks there.

I have created another webform called Default2.aspx, this is where i want the user to enter a simple password and if it meets the requirements on a button click event, it will open up the Default.asxp web form.

I realise postbackurl works great on the button properties but with my if statement, i just cant get it to work no matter what i look at. Tried adding using Sytem.Windows.Forms or using Form1 frm = New Form1 and Form1.Show but to no avail.
My simple if statement.


if {txt_password.Text == "requests")
{
"here i need to show deafault.aspx form"
}

Any help would be really appreciated while i keep looking.

Is This A Good Question/Topic? 0
  • +

Replies To: Visual Studio - c# - switching Webforms

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1449
  • View blog
  • Posts: 5,761
  • Joined: 21-March 08

Re: Visual Studio - c# - switching Webforms

Posted 20 January 2012 - 11:44 AM

Normally, you would use Response.Redirect method.

Do not add System.Windows.Forms to the ASP.Net project. That's for WinForms, which are useless in ASP.Net. You will never need to include that reference.
Was This Post Helpful? 0
  • +
  • -

#3 lashy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 20-January 12

Re: Visual Studio - c# - switching Webforms

Posted 21 January 2012 - 03:16 AM

#2 eclipsed4utoo

Thankyou very much it works great, looked on and off most of friday and not once did did Respone.Redirect pop up.
Again thanks, really is appreciated.
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is online

  • WillMyCodeWork = !FailedWhenYouTriedIt;
  • member icon

Reputation: 3290
  • View blog
  • Posts: 6,895
  • Joined: 02-June 10

Re: Visual Studio - c# - switching Webforms

Posted 21 January 2012 - 08:17 AM

You might also what to read the login tutorial in FAQ 18

TOP most asked:
What does this error message mean?
FAQ 2: How do I debug
FAQ 3: How do I make Form1 talk to Form2



FAQ (Frequently Asked Questions - Updated Jan 2012

Spoiler

This post has been edited by tlhIn`toq: 21 January 2012 - 08:17 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1