Passing values between server controls

h0lly

New member
Joined
Feb 18, 2009
Messages
3
Programming Experience
1-3
I have created 2 server controls. The first creates a listbox and the intention is for the second control to pick up the value.

My second control has:
Dim myControl1 As New Control

Get
myControl1 = CType(FindControl("testListBox"), ListBox)
'myControl2 = myControl1.ID
If (Not myControl1 Is Nothing) Then
CurrSelectedVal = myControl1.ID
Else
Dim noval
noval = "Nothing"
End If
Return CurrSelectedVal
End Get

but this is obviously wrong.
Is it possible to retrieve the value?
 
passing values between controls

Further to my original post, I've still not found a solution to this.

Subsequently, I've tried using Page.FindControl(name of control)
but though the control is found and I get the ID I cannot get the value selected.

I get "object not referenced...."

After finding the control, the process jumps to the CreateChildControl()
and loops through the content of the child control.

I'm thinking that maybe when selecting from the listbox in the custom server control, I need to pass the selected items into a hidden field in a call to the event handler and then retrieve thos values but this seems a bit of a convaluted way. Surely the event handler for a button can retrieve values from multiple custom server controls?
 
Back
Top