I am trying to use the update command capability of the SqlDataSource control. I only have two parameters to pass to the command. When both parameters (@key_id, @value) are the default value of the controls used to get them the procedure works correctly. The difficult comes when I want to use a multiselect list box to collect correct values for the @value parameter. The approach I am trying to take is to use the updating event of the SqlDataSource to get the values for the listbox. The code I have is shown below.
This approach works when I set the code in newcodeblock to: GetAllValues = "blue" but obviously with the wrong value.
What I need to know is which parameter (sender or e) can I pass to the function GetAllParmeters to extract a reference to the mutliselect listbox so that I can get the selected values and assemble them into their correct form (e.g. a concatonated string).
If a reference to the listbox cannot be obtained at this point, is there a way of getting the correct values another way?
This approach works when I set the code in newcodeblock to: GetAllValues = "blue" but obviously with the wrong value.
What I need to know is which parameter (sender or e) can I pass to the function GetAllParmeters to extract a reference to the mutliselect listbox so that I can get the selected values and assemble them into their correct form (e.g. a concatonated string).
If a reference to the listbox cannot be obtained at this point, is there a way of getting the correct values another way?
Protected Sub SqlDataSource1_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource1.Updating
e.Command.Parameters(
"@value").Value = GetAllValues(sender)
End Sub
Private Function GetAllValues(ByVal sender As Object) As System.String
'do something to set a reference to the listbox so selected values can be concatonated
newcodeblock
End Function