Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Thousands of businesses have used Microsoft ASP.NET to build professional, dynamic websites. In this course, web developer David Gassner demonstrates the tools needed to build and deploy a dynamic site using ASP.NET 3.5 or 4.5. Covering everything from installing and configuring Visual Web Developer 2008 or Visual Studio Express 2012 for Web and SQL Server Express to creating web form pages, this course is designed to give beginning and intermediate developers hands-on experience.
After you define a database connection in Visual Web Developer, you can then present data easily in any ASP.NET page. I'll be working with the file Default.aspx, which was created automatically when I created the new website. First, with Default.aspx in Code view, I'll click into the Title element within the head section and I'll put in a title of Author List. Then, within the div tag, I'll add an h1 tag set and within the h1 tag set I'll once again type in Author List. Then I'll look at the page in Design view. Notice that the Author List heading is displayed on the screen. Next, I'm going to press Enter. This results in creating a new paragraph in the page. Now, to actually display the list of authors on the page, all I'll need to do is drag the Authors table from the Database Explorer into the page. Visual Web Developer will take care of everything in the background. I'll go to the Database Explorer. From there I'll open my list of tables, and I'll locate the Authors Table, and I'll click and drag the Authors table, and drop it inside the paragraph.
After a moment, I'll see a grid view appear. A grid view is a rendering of an HTML table that dynamically presents the data. I'll describe in detail how to use a grid view in other videos, but for now, I'm just going to save and test the page. I'll save the file, then I'll go to the Menu and select Debug > Start Without Debugging, or press Ctrl+F5. Visual web developer starts up the development web server and runs the page and displays the data automatically. You'll see that all of the columns from the database table are displayed: the primary key, the author's first name and last name, and so on. Now, I'll describe some of the things that happened in the background when I dragged the table into the page. I'll close the browser, and first let's take a look at the code that was generated in Default.aspx. I'll click on Source View, then go to View > Full Screen so I can see as much code as possible. Notice that I created something called a grid view.
The grid view generates the HTML table code that's presented by the browser. A little further down, I'll find a little bit of code that generates something called an SqlDataSource. The SqlDataSource describes how I'm going to retrieve the data from the database server. And most importantly, it uses something called a ConnectionString. A ConnectionString is a definition of the location of the database and a description of how I'm going to connect to it. And you'll see that an automatic ConnectionString called mybookstoreConnectionString1 was generated by Visual Web Developer. This ConnectionString is defined in a file called Web Config. Go to the Solution Explorer and open the web.config file. I press Ctrl+F. That opens up the Find and Replace dialog. Type in "Connection" and click Find Next and then close the Find and Replace dialog. You'll see that a new element called ConnectionStrings has been added. And then within the ConnectionStrings element, there's an add element with a name of mybookstoreconnectionString1. And then the definition of the database and how I'm connecting is right here. It says connectionString=Data source=localhostsqlexpress;Initialcatalog=mybookstore, which is known in SQL Server as the database name. And Integrated Security=True. Integrated Security is what's known in Visual Web Developer as Windows authentication, meaning I don't need to provide my username and password to authenticate and use the database. Once the ConnectionString has been defined once in the web.config file, it can then be used throughout the rest of my website. It doesn't have to be defined new each time, and its also important to note that even though I had previously defined the connection in Visual Web Developer, the connection was only defined for this particular website when I dragged my first bit of data into my first page. Until then, the database connection information was being managed by Visual Web Developer, and it will now be available to all the websites that I use, as long as I'm using this copy of Visual Web Developer and I'm logged in as myself on my copy of Windows.
Find answers to the most frequently asked questions about ASP.NET Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.