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.
The final task in a data entry system is to give the user a way to delete records from the server-side database. The GridView control gives you a very easy way to do this simply by enabling the Delete functionality. I will be working with the file Authors. aspx. In this file, there is already a GridView control, which is bound to the SQLDataSource control at the bottom of the page. The SQLDataSource was created with the Delete command with the parameter that allows the Delete command to be filtered on a single record's primary key.
To turn-on Delete functionality, I'll go into Design View first. I'll select the GridView and then open its Task list and I'll select Enable Deleting. This results in creating a Delete column on the left side of the GridView. Now I'm going to edit the columns so I can group the Edit link and the Delete link together. I'll click Edit Columns, I'll go to the Selected fields list and choose Delete. And then I'll click the Down Arrow a number of times until it's the last item in the fields list. So now the user will see the Edit hyperlink column and then the Delete link. I'll click OK and then I'll test the page in the browser selecting Debug > Start Without Debugging.
With the addition of the Delete link, you will now see that the columns are a little bit squeezed and text is starting to word-wrap. You can solve this in one of two ways. You can either go to individual columns and edit their properties and set their Wrap properties to false, or you can cite that on a list page. You don't really need to display all this detail. I'll close the browser, I'll go to the Task list for the GridView control and click Edit Columns and then I'll go to the Selected fields and I'll remove a few of these items. I'll remove the Address, the City, the State, and the Zip, leaving only the Last Name, First Name, and Phone Number.
I will click OK, I'll save my changes by pressing Ctrl+S and then I'll run the page again, and now the user is only seeing those critical columns that allow them to identify the rows and get a bit of critical information such as the phone number. All of the other functionality will still work. I can click into an item and see its details in the Update page and Cancel to return to the list. But I can now click the Delete link and that row will be deleted, and with the page refreshes it shows that the data has been removed from the server-side database.
So Edit links and Delete links are now placed in the rows that they are going to affect, and the link to add a new author has been placed below the list control because that takes the user to the Insert Author page. Your data entry system is now complete.
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.