Rob
Rob

Reputation: 59

C# Web Application Page Load with Method call

I have a web application with two pages at the moment, The first page the user needs to complete some details, with a button that needs to open the second page with a list of buildings and the user needs to choose one of to populate a list of textboxes in the first form.

My question is, from a button on the first page. (CreateSurvey.aspx) I want to open the second page (Search_Property.aspx)

I have come across syntax like

Search_Property Search = new Search_Property();

        Search.open(); 

But the .open does not exist in this context.

Could someone help me please.

Regards

Rob

Upvotes: 0

Views: 285

Answers (2)

reckface
reckface

Reputation: 5858

In Web forms, you open pages by redirecting to the new page. So, in your button click event, you would use:

Response.Redirect("Search_Property.aspx"); or Server.Transfer("Search_Property.aspx");

And of course there's the option to modify your button markup to post directly to Search_property.aspx as shown here:

<asp:Button ID="searchButton" runat="server" Text="Search" PostBackUrl="~/Search_Property.aspx" />

Upvotes: 1

Jay Buckman
Jay Buckman

Reputation: 578

If you don't want to navigate to another page and then back again, there are several options. You can create HTML "dialogs" in your CreateSurvey.aspx page and show/hide them as necessary. You can also use an IFRAME on the CreateSurvey.aspx page to display the Search_Property.aspx page and then use some Ajax (HttpXmlRequest) to update the CreateSurvey.aspx page.

Upvotes: 0

Related Questions