Presenter:Joe Stagner
In this video I will demonstrate how to retrieve values from server side AJAX controls like the ones found in the AJAX toolkit.
The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video
Minute 0
Will rule CEO should now uses server side Ajax controls was found in the Ajax control children in previous video I demonstrated the use of the reorder list control under the used as an example as to how to retrieve the values however this technique is appropriate for most of the Ajax control toolkit controls and control extenders that are allowed to contain other content so they issue here is a wreath at this we have this implementation here of reorder list rights of think about this muscle is specifically as the reorder was control but as an Ajax toolkit control and one of the things that can happen is in his in his in this control I have these item templates and in this item template
Minute 1
I have a couple of labels and a lot of able to retrieve the the specific values attacks values from those labels for problem is though that this item template contains shelf content so it can in fact be any kind of ASP net control so there isn t any structured in there is any sort of structured mechanism that exposes the values of those particular controls because there are they are limited in pipe or a number sorting is a technique that helps us go and get those get those on in this case label of the text values of those label controls that are contained in this item template remember these can be text boxes that could be image controls and can basically be any ASP net control cell on quantity areas a outside the give and add a button and
Minute 2
Click on the button to get AI code behind event handler for the click event and in addition here I m going to just add another label control soon be a standard is the unnamed label control this one of the values I retrieve so and even as click event here s what primitive so first and Anita I know that what I ve contained in that item template in my reward was control is a couple labels so let s dim up from his column L1 and L2 as a label just for local use here and underneath miniatures so let s doomed in fact says integer and
Minute 3
A label three texts is just said that the equal to or if you value of this one a hop back over your mission that was in fact label three yes okay so now I ll unspeakable things to the pursuant to do is find out how many items are in the collection that were to iterate through soliciting Max reorder list one items Count minus two this is to the beginning loop through them and so riven with a rare loop from the first to the last of the items in the collection and were going to do this in a way that respects
Minute 4
He the array indexing for VB so now we can just say a floor I equals zero to Max Bell 1 see type 3 reorder list one items I sort iterate through each of the each of the items in the items collection that appears in our reorder list and wait to find the label controls and sent season user definable on we need to actually call to find control and pass in the name of the the ASP net control that we want to retrieve the value from so
Minute 5
For our churches label wanted label to me to remind you what type is in and so that ll get us label one now let s just go ahead and again use the magic of cut and paste say we want to get from one store that ill to and were interested in controlling labels to the now all we need to do is set the valid tax value of the label control that we want to populate so and let s just do this in an attending fashion writes it will say legal free text which we ve started out by setting to nothing equal whatever s already in their loss and will a couple of spaces and then was a time
Minute 6
L 1 tax and spend a couple more spaces and then killed two attacks and then because reiterate through all of them lets for Adeline breaks to the below the device format and now let s go ahead and run our application essays he was not gone all these items that are in our list if I click on this button to notice it we get the the two parts of the to each of the two text labels and of course the ones were adding a row and adding to one of the two labels but
Minute 7
Bar code behind iterates through all of the items in a list and returns the values in to our label free feel from a narcissist ever trees them in the sorted order so we haven t posted them back out to the database to change the order but do I think it s that easy in one of the zealots remember here is that is that this mechanism is not specific to reorder list so one of the things I often get questions from folks are using the Ajax control toolkit controls and they want to know how to get the value of some piece of content is placed inside an item template in the control whether to reorder with control or some other type of control so basically this is the mechanism is that you re going to actually call find control passing in the name that you ve identified the ASP net control with and then also specifying a enough to specify what type it is a easy type for a poor
Minute 8
Other casting mechanism and by doing this you can access the the data elements in each of the controls are containing your item template subset of the Celts tell you I get the items the item values out of the item templates in your ASP net Ajax control toolkit controls of all don t
Click here to go to original video page
Friday, July 18, 2008
Video: How Do I: Retrieve Values From Server Side AJAX Controls
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment