Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
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.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98223 Viewers
61 Video lessons · 85535 Viewers
71 Video lessons · 69488 Viewers
56 Video lessons · 101826 Viewers
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.
Your file was successfully uploaded.