ASP.net open new webform on click of button - asp.net

I am using C# ASP.net, and relative new to it, and need to accomplish below.
In my VS2010 web application project I have default.aspx, form1.aspx with button1 and form2.aspx.
1-I want to set form1 as my home page (the first page that opens when I run app)
2-Want to open form2 when I click button on form1
Also, can you please suggest good book that covers items like above?
thanks
Jay

Quick start would be to double click the "button1" in designer view, which will generate a button1_click(...) event handler. In this routine, you could write one line of code:
Response.Redirect("~/form2.aspx");
To set Form1.aspx to your "homepage", it would make sense to rename it to "default.aspx" which is usally the page IIS looks for to start from.

hope it helps,
When publishing, in the IIS you have to make the default page the form1.aspx page. In your VS2010 just right click on the file and set it as start page.
Yes, the Response.Redirect answer posted is correct.

I've found that ASP.NET Unleashed is really helpful for beginners. You can find it on amazon:
http://www.amazon.com/ASP-NET-4-Unleashed-Stephen-Walther/dp/0672331128

Related

How do I Create an Entire Web Form along-with its respected Code-Behind(.cs) file in Asp.Net on click of a button?

I Want to create an entire Web-Form on click of a button along with its Code-behind(.cs) file . I can work fairly with Asp.Net but i love to explore new things.just a question that popped up in my mind while working on something new ! So please if anyone of the great minds out there can help please help me out. Thank You.
Instructions for Visual Studio 2013
Open your web solution
In Solution Explorer, right click the web project
Choose "Add Web Form"
Enter a name for the form
Click OK
See also this link
Just extend Web Form class, define properties and methods which will render and show your web form. Handle button click event, initiated web form. Finally display it.
If its normal form you can simply render it using jQuery/JavaScript.
Hope this helps you buddy. :)

How to open multple aspx page one by one on page close event

I am working on ASP.net Web application. I have a aspx page called "print.aspx"
I need to write a logic to load again the same page again on closing of that page (pressing the "close" button of that page.
(attached image)enter image description here
Can you please guide me how can I achieve this ?
I think The best way to use Thread's and implement async method's with await...

Combining ASP.NET webforms

I have created 9 webforms in a project called "PIMS". I have not linked any form together simply because I dont know how to do that. Now when I load and run the application, it presents to me only the form that I have selected to run as "Start Page". How can I link all 9 webforms together present all the forms to users so they can choose the form they want to work on. Please suggest.
Kind regards,
You can link any page or form by tag Anchor
Click Here To Visit Form 2
or any page
Click Here To Visit Page 2
or you can use ASP.NET Controls like HyperLink
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="form2.aspx">HyperLink</asp:HyperLink>
in advance you could use Javascript plugins to make menu with motions and good user experience
for example http://jqueryui.com/menu/
This is for winform only
First form is close and other form is open this way
frmHome frm = new frmHome();
frm.Show();
this.Close();
frmHome is ur another from thats way u can open and close ur all forms.

Navigate back in visual webgui

I'm a newbie of ASP.NET world. I'm developing an app with asp.net and insiede of an aspx page i'm using a window form developed with visual webgui.
I've this problem: inside my form, i have a button wich has to rise an event equals to the page back button of the browser.
I tried to search informations about this, but i can't find anything unfortunately.
I think that i've to do something with the HttpContext. I tried with the Redirect function but my "previous page" is open always in a new browser window.
Can someone tell me a way on how to do this thing please?
Thank's
Marco
EDIT SOLVED
button.RegisterClientAction("history.go( -1 )", "");
Cant you do this:
Response.Redirect(Request.UrlReferrer.ToString());

How do I build a popup dialog in asp.net

I am building a Web Application using asp.net (C#). I come from windows forms development and find myself in a hard spot. Im making an application where the user should edit some simple information about himself, and thus i need to create a new dialog. How do I do that in asp.net? I have a button which event is handled serverside, and when i click lthis button i want to popup a dialog where i can show my custom web control (or any web control, lets make it generic from the start). How do I go about with doing so?
I got some part of the way by looking at the internet, that i need to make a section and set the z-index to 1000, but how do i make it visible (block)? Please help here as i am completely lost...
/H4mm3rHead
If you're not concerned about using a library, try Microsoft ASP.NET AJAX Control Toolkit, they have several controls that can create something you want (the ModalPopup control).
The AJAX Control Toolkit has a ConfirmButton extender which will do exactly what you are looking for.
I used to do the following:
1. my new pop up is just a new aspx page like any other page
2. add a button (or just a link) that fires a client side java script function
3. in the function I use window.open and put params to open my popup page with no toolbars or scrollbars and proper size to its content
check this for more info on #3

Resources