Adding New Pages In Asp.Net Application (ASP.Net 3 of 44)

ManzoorTheTrainer
12 Feb 201207:47

Summary

TLDRThis tutorial demonstrates how to add new pages to an existing web application using ASP.NET and navigate between them. It covers creating a default page, adding a new web form, and linking pages using hyperlink controls, converting text to hyperlinks, and drag-and-drop navigation. The video also explains setting a startup page to ensure the application always begins from a specified page, offering various methods to manage page transitions effectively.

Takeaways

  • 📝 The demo is about adding new pages to an existing web application and navigating between them using ASP.NET features.
  • 🔨 It starts with creating a default page and adding a message to it, saving the changes.
  • 🚀 Demonstrates adding a new page by right-clicking the project, selecting 'Add New Item', and choosing a Web Form named 'my page'.
  • 🔗 Shows how to link the default page to the new page using a hyperlink control, setting its properties to navigate to 'my page'.
  • 🖌️ Explains editing the hyperlink text to 'my page' and setting the navigation URL to redirect to the new page.
  • 🔄 Describes navigating between pages by clicking on the hyperlink, which is tested in the execution.
  • 🔄 Another method of navigation is converting a text link to a hyperlink using the 'Convert to Hyperlink' icon.
  • 🔗 A third method is dragging and dropping a page from Solution Explorer to create a link directly to it.
  • 🔑 Highlights creating a button on the page and using the 'btn_my_page' click event to redirect to 'my page' with Response.Redirect.
  • 🏁 Discusses setting the default page as the startup page so that the application always begins from this page, regardless of the current page.
  • 🛠️ Concludes by emphasizing the simplicity of adding multiple pages and navigating between them using various methods in ASP.NET.

Q & A

  • What is the main topic of the video demo?

    -The main topic of the video demo is how to add new pages to an existing web application and navigate through different pages using features in ASP.NET.

  • What is the default page provided when creating a new web application in ASP.NET?

    -The default page provided when creating a new web application in ASP.NET is typically named 'Default.aspx' or 'Index.aspx'.

  • How can you add a new page to an ASP.NET web application?

    -You can add a new page to an ASP.NET web application by right-clicking on the project in Solution Explorer, selecting 'Add New Item', choosing 'Web Form', and naming it.

  • What is the purpose of the 'hl' prefix in the hyperlink property window?

    -The 'hl' prefix in the hyperlink property window is used to indicate that the hyperlink will link to a specific page, making it clear for developers what the hyperlink is intended to do.

  • How can you link one page to another using a hyperlink in ASP.NET?

    -You can link one page to another by dragging and dropping a hyperlink control, setting its properties to link to the desired page using the 'NavigateURL' property, and specifying the link text.

  • What is the alternative method to create a hyperlink to a page without using the hyperlink control?

    -An alternative method to create a hyperlink is by writing the page link directly and using the 'Convert to Hyperlink' icon to transform it into a clickable hyperlink.

  • How can you navigate to another page using an anchor tag in HTML?

    -You can navigate to another page using an anchor tag by specifying the 'href' attribute with the path to the desired page, which is created when you drag and drop the page onto the HTML editor.

  • What is the purpose of the 'btnMyPage' button in the video demo?

    -The 'btnMyPage' button is used to demonstrate how to navigate to another page when the button is clicked, by using the 'Response.Redirect' method in the button's click event handler.

  • How can you ensure that the application always starts from the default page?

    -You can ensure that the application always starts from the default page by right-clicking the default page in Solution Explorer and selecting 'Set as Start Page'.

  • What happens when you set a page as the startup page in an ASP.NET application?

    -When you set a page as the startup page, the application will always navigate to this page when it is executed, regardless of which page you were on when you stopped the execution.

  • How can you add a button to navigate to a specific page on a click event in ASP.NET?

    -You can add a button to navigate to a specific page by dragging and dropping a button control onto the page, writing the navigation code in the button's click event handler using 'Response.Redirect', and setting the button's text.

Outlines

00:00

🛠️ Adding and Navigating Pages in ASP.NET Web Applications

This paragraph demonstrates the process of adding new pages to an existing web application using ASP.NET. It starts by introducing the 'add pages example' and proceeds to show how to create a default page with a message. The speaker then guides through the steps of adding a new web form page named 'my page', writing content for it, and linking it to the default page using a hyperlink control. The hyperlink is configured to navigate to 'my page' upon clicking. Several methods for creating navigation links are discussed, including using standard controls, converting text to hyperlinks, and dragging pages directly from the Solution Explorer. The paragraph concludes with a demonstration of navigating between pages and emphasizes the simplicity of adding and linking pages in ASP.NET.

05:01

🔄 Navigating Pages and Setting Startup Options in ASP.NET

The second paragraph continues the tutorial on web application development, focusing on navigating between pages and setting startup options in ASP.NET. It begins with the addition of a button control to a page, named 'btn my page', which when clicked, is intended to redirect the user to 'my page'. The speaker writes the necessary code for the button's click event to perform the redirection using the 'Response.Redirect' method. The paragraph then illustrates different ways to navigate to 'my page', such as setting it as the startup page, which ensures the application always begins at the default page regardless of the user's current location within the application. The speaker emphasizes the flexibility of navigation options and the ease of setting a startup page in ASP.NET, concluding with a demonstration of the application's navigation functionality.

Mindmap

Keywords

💡Web Application

A web application is a software program that runs on a web server and is accessed through a web browser. In the video's context, the focus is on adding new pages to an existing web application, which is a common task in web development to expand functionality or content.

💡ASP.NET

ASP.NET is a web development framework provided by Microsoft that allows developers to build dynamic web sites, applications, and services. The video demonstrates how to utilize ASP.NET features to add and navigate through pages in a web application, showcasing its capabilities for web development.

💡Default Page

The default page is the initial page that loads when a web application is accessed. In the script, the default page is the starting point for the demonstration, where the process of adding new pages begins, and it is also used to establish a hyperlink to navigate to other pages.

💡View

In the context of the video, 'view' refers to the visual representation of a web page in a development environment. The script mentions going to the 'view' to write a message on the default page, indicating the visual aspect of the web application development process.

💡Solution Explorer

Solution Explorer is a tool in Microsoft's Visual Studio that allows developers to navigate through the files and components of their projects. The script describes using the Solution Explorer to add new pages and manage the project's structure.

💡Web Form

A web form is a component of a web application that allows user interaction, such as inputting data. The video script describes adding a new web form named 'my page', which is a key step in expanding the web application's capabilities.

💡Hyperlink

A hyperlink is a clickable element in a web page that navigates the user to another page or resource. The script explains how to create a hyperlink in ASP.NET to link the default page to the newly created 'my page', demonstrating a fundamental aspect of web navigation.

💡Property Window

The property window in a development environment allows developers to set attributes and values for elements within their project. In the script, the property window is used to configure the hyperlink's properties, such as its name and navigation URL.

💡Navigate URL

The navigate URL is the address to which a hyperlink directs the user. The script mentions setting the navigate URL to redirect the user to 'my page' when the hyperlink is clicked, illustrating how hyperlinks control navigation within a web application.

💡Button Click Event

A button click event is a programming construct that triggers a function or action when a button is clicked. The video script includes an example of writing code for a button click event to redirect the user to 'my page', showing how interactive elements can be programmed for navigation.

💡Startup Page

The startup page is the page that loads when a web application is launched. The script explains how to set the default page as the startup page, ensuring that the application always begins at this page regardless of the user's previous location within the application.

Highlights

Introduction to adding new pages to an existing web application using ASP.NET.

Creating a default page with a message indicating it is the default page.

Adding a new web form page to the project via the Add New Items dialog.

Naming the new page 'my page' and adding it with a code-behind file.

Writing a message on the new page to distinguish it from the default page.

Linking the new page to the default page using a hyperlink control.

Setting the hyperlink properties to navigate to the new page when clicked.

Demonstrating how to execute the application and navigate between pages.

Using the 'Convert to Hyperlink' feature to create a clickable link to the new page.

Exploring different ways to navigate between pages, including drag and drop.

Creating a button on the page and setting it to redirect to the new page upon click.

Writing code for the button click event to perform the page redirection.

Executing the application to show the button click navigation in action.

Discussing the importance of setting a startup page for the application.

Demonstrating how to set a default page as the startup page.

Highlighting that the startup page will be loaded regardless of the current page.

Conclusion summarizing the simplicity of adding and navigating between pages in ASP.NET.

Transcripts

play00:08

hello in this demo i am going to show

play00:11

you how to add new pages to our existing

play00:14

web application or to an application and

play00:18

how to navigate through different pages

play00:20

with the help of different features that

play00:22

we have in our asp.net so i'm going to

play00:26

name it as

play00:30

add

play00:31

pages example

play00:34

let's say okay

play00:46

so as usual it is going to give me a

play00:48

default page

play00:50

and i will just go for the view and

play00:52

solution explorer i have got default

play00:54

page now in this default page

play00:57

i'll write some message saying that this

play01:00

is

play01:01

my

play01:03

default page

play01:06

i'll save this now if i want to add one

play01:09

more page

play01:11

as we have default in the same sense i

play01:13

can just select my project

play01:16

right click on it

play01:18

and i'll say add new items

play01:30

and i am going to select a web form and

play01:33

i'll name it as

play01:36

my page

play01:39

and i'll simply say add

play01:42

so it has added me my page with

play01:45

code behind

play01:47

file along

play01:48

with it

play01:51

now i'll just go to the design and here

play01:54

i'll write it as

play01:55

this

play01:56

is

play01:58

my page

play02:02

now i'll go back to my default page and

play02:04

what i want

play02:07

i want to link

play02:10

this page with my page so i can simply

play02:12

go to the standard controls and i can

play02:14

drag and drop a hyperlink

play02:17

i can go to the properties

play02:22

and in property window i can name it as

play02:25

hl prefix

play02:27

hyperlink with hl

play02:29

hl

play02:31

my page so that

play02:33

we will come to know that it is going to

play02:35

link to my page and the text

play02:37

instead of hyperlink i will just write

play02:39

it as

play02:41

my page

play02:44

and whenever i click on this link it

play02:47

should navigate me to

play02:50

navi with the help of navigate url i can

play02:52

set that it should redirect me to my

play02:55

page i'll just browse this and here i

play02:58

have got all the pages of my solution

play03:00

explorer i'll just select my page and

play03:02

i'll say okay

play03:04

so whenever i click on my page link it

play03:06

is going to take me to

play03:08

my page i'll save this

play03:10

and i'm going to execute this now i am

play03:13

on default aspx page whenever i click on

play03:15

my page it should take me to my page

play03:18

so i'm on my page i can go back again

play03:21

click on my page i'm coming on my page

play03:24

i'll simply close this

play03:26

stop the execution

play03:29

this is one way to navigate from one

play03:31

page to another page

play03:34

another way is simply you can write my

play03:37

page

play03:40

link

play03:41

and i'll select this

play03:44

and i'll just go for convert to

play03:46

hyperlink icon the same icon we have in

play03:49

our word document

play03:51

and i'll click on this

play03:53

and here i'll just say browse

play03:55

and i'll browse to my page

play03:58

say okay and i'll execute this

play04:02

this is going to work in the same sense

play04:04

it is going to

play04:05

put an anchor tag for me an html anchor

play04:09

tag

play04:17

it takes me to my page

play04:23

another way or the easiest way is very

play04:26

simple you have your my page over on the

play04:29

right

play04:30

in your solution explorer just select

play04:31

that page drag and drop it

play04:35

so you'll get a link to that particular

play04:37

page

play04:41

i'll run this

play04:45

if i click on my page it should take me

play04:47

to that page

play04:49

now this is one of the many ways

play04:52

of navigating from one page to another

play04:54

page

play04:55

now

play04:56

the last thing that i want to show you

play04:58

is

play04:59

on a button click

play05:01

so i have a button i have dragged and

play05:03

dropped the button on my page these are

play05:05

the standard controls anyway we are

play05:07

going to see these controls in our next

play05:09

video in depth each and every control

play05:12

now i take a button

play05:14

i'll name it as

play05:16

btn

play05:18

my page

play05:20

and whenever i click on this it should

play05:22

take me to my page so just i'll just put

play05:24

the text as my page

play05:29

on the button click it should redirect

play05:31

me to my page so i'll just double click

play05:34

the button and i'll write the code

play05:36

anything related to that button click in

play05:39

button underscore click event

play05:42

so

play05:43

the event that i get whenever i click

play05:45

the button is

play05:47

click event so id of the button

play05:50

underscore click so whenever i click the

play05:52

button this code gets executed whatever

play05:55

i write in this open bracket and close

play05:56

the bracket so i'll just try to redirect

play05:59

my control from default page to my page

play06:03

so i'll say

play06:05

response dot

play06:06

redirect

play06:08

to

play06:11

my page

play06:13

dot aspx

play06:22

and i'll execute this

play06:25

now whenever i click the button it

play06:27

should take me to my page

play06:29

so i'm on my page so i have shown you

play06:31

many ways

play06:33

of navigating from one page to another

play06:35

page so we'll be using

play06:38

anyone depending upon our situations

play06:40

now if i am on my page and execute my

play06:43

application

play06:44

so it is going to take me to my page

play06:46

directly

play06:48

now what i want is

play06:50

wherever i may be i may be on page xyz

play06:53

or whatever it may be it should start

play06:55

from default page so i can select the

play06:57

default page i can make it as a startup

play06:59

page

play07:02

i just right click it and i'll say set

play07:04

as start page

play07:06

and if at all i am on my page and

play07:08

execute my application it will take me

play07:10

to the default page by default because

play07:12

it is the startup page even if you have

play07:14

100 pages and if i'm on 99th page it

play07:17

will take me to the first page whatever

play07:19

i have set as set as startup page

play07:23

so that's it so this is very simple to

play07:26

add multiple pages to your application

play07:28

you can do in this way and you can

play07:29

navigate from one page to another page

play07:32

using one of the many ways that we have

play07:35

thank you very much

play07:46

you

Rate This

5.0 / 5 (0 votes)

Related Tags
ASP.NETWeb DevelopmentPage NavigationWeb FormsHyperlinkButton ClickDefault PageCode BehindSolution ExplorerWeb ApplicationTutorial