Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When you create an asp dot net page that's dedicated to updating records, you need to pass a quarry stream parameter to the page as it's loaded to indicate which record you want to edit. In the video where I created author update dot aspx, I modified the select command for the squal data source. I set up the select command to receive a parameter which would be used in a where clause, shown right here. The parameter has a name of AU_ID, matching the database column name on the server.
And then I added a select parameters element to the SQL data source, and indicated that I wanted to get that parameter from the query string using the query string parameter tag. I set the name attribute to au_id to match the name of the parameter in the Sql statement and the query string field to au_id. Now I'll show you how to pass that value from the list page so the user can click a button and get to the page easily. I'll go to the file Authors.aspx. This is the list page that displays the existing data from the author's table.
I'll click on the gridview control and then open its task list. From there, I'll click on add new column. I'm going to add a column that generates a hyperlink. You can actually create either a hyperlink or an actual button, they both work pretty much the same way. From field type I'll select Hyperlink Field. The header text can be left blank. I don't need anything at the top of the column. But then, in the Specify Text input, I'll type in Edit. That's what the user will see. Next, I'll indicate that I want to construct the URL to which the user will navigate using a data field.
I'll click into the first input and type in the name Of the primary key column, au_id. Because it's a primary key, its value will be used to uniquely identify the row the user has selected. Then, I'll pass in the URL format string. I'll start with the tilde and a slash To indicate I'm starting at the website root, and then, I'll type in the name of the update page, AuthorUpdate.aspx. I'll follow that with the question mark to indicate that I'm starting the query string or the list of parameters.
Then I'll put in au_id as the name of the parameter, an equals operator, and then brace zero brace. To indicate that I want to take the value of the first state of field, I list in that string, and pass it in this position. I'll click" ok" and show that the edit hyperlink is shown in display view. I'll press Control+S to save and Control+F5 to run the page. Now I can click the edit link for any of these records. I'll choose the third one, Andy Arf. That takes me to the edit form and displays the data for that single record.
I'll change Andy's first name from Andy. To Andrew. Click the update link and then, when I return to the author list, I'll show that the data has been successfully updated. Once again, you don't have to use a hyperlink, you can also use a button control in that position. The architecture is pretty much the same, but because I'm using a hyperlink throughout the rest of the website, I've chosen a hyperlink for this purpose as well. Now, I'll show you the generated code. I'll close the browser, and return to visual web developer. Go to the declaration of the grid view control, and show that the hyperlink was created, with a control called asp colon, hyperlink field, shown here.
Notice that the property Data Navigate Url Fields lists the fields that are being passed in and then the property Data Navigate Url Format String indicates how the url will be built. That's shown right here. And finally the text property indicates what the user sees. So that's how you bind the whole data entry system together. The user starts at the author list. From there, they can click the add new author link. That takes them to the insert page. They can then insert a record. Or they can click the edit link and from there, they can go to the update page and modify existing data.
Either way, at the end of the operation, they always return back to the list page.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101208 Viewers
61 Video lessons · 87960 Viewers
71 Video lessons · 71842 Viewers
56 Video lessons · 103691 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.