problem how to pass value from one procedure to another



Hi,

I create 5 dropdownlist in code-behind. I want to insert their
selectedvalues in a table by making a string separated with ":"
I can get their selecedvalues but i'm stuck when i want to execute the
insert.
The error is "name dd is not declared" (in line: selvalue = selvalue &
Session("dd" & dd.id) & ":"

Any idea how to solve this?
Thanks for help
Dan

Dim dd() As DropDownList
Dim i As Integer

for i= 1 to 5
dd(i) = New DropDownList
dd(i).ID = id 'can be anything
next

For Each d As DropDownList In dds
AddHandler d.SelectedIndexChanged, AddressOf dropd
Next

Protected Sub dropd(ByVal sender As Object, ByVal e As System.EventArgs)
Dim dd As DropDownList = CType(sender, DropDownList)
Session("dd" & id) = dd.SelectedValue
End Sub

Protected Sub submit_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim i As Integer
Dim selvalue As String
For i = 1 To 5
selvalue = selvalue & Session("dd" & dd.id) & ":"
Next
sql="insert ....."
....






.



Relevant Pages

  • Re: selectedvalue postback problem
    ... Protected Sub Page_Load ... return the good value and the ddl items are stil present. ... have to recreate the dropdown list first, and they it'll take care of ... Dim row As DataRow = CType ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: What if the Query String is empty?
    ... Protected Sub Page_Load(ByVal sender As Object, ... Dim intProductID As Integer = Trim) ... Dim intProductID As Integer = Trim) ...
    (microsoft.public.dotnet.framework.aspnet)
  • executing stored procs
    ... Dim oDataComponent As New ... Protected Sub ddlPlurality_SelectedIndexChanged(ByVal sender As ... lblPlurality.Text = "Verify Plurality" ...
    (microsoft.public.dotnet.languages.vb)
  • Re: GridView disapears after entering edit mode.
    ... Protected Sub Page_Load ... Dim mCommand As SqlCommand ... Dim cnSQL as SqlConnection ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: GridView disapears after entering edit mode.
    ... Protected Sub Page_Load ... Dim mCommand As SqlCommand ... Dim cnSQL as SqlConnection ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)