I would wager you are rebinding the list when you load the control,
which always happens on postback.  You need to wrap the code to bind
the list in an If...Then block, something like...

If Not Page.IsPostBack then
 'Code or call to bind list
End if

--- In [email protected], "robrap_1976"
<[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I have a function on a webcontrol that returns a comma seperated 
> string of all the selected values but even when I select values and 
> step through there are no selected items. And on the postback all 
> selected items are reset i.e nothing is selected. I have checked to 
> see that view state is enabled and it is.Any ideas why this isnt 
> working ? 
> 
>  
> ASCX
>         Public Function GetSelectedItemString() As String
>             Dim item As ListItem
>             Dim strTemp As String
> 
>             For Each item In cboChannel.Items
>                 If item.Selected = True Then
>                     strTemp = strTemp & "," & item.Value
>                 End If
>             Next item
> 
>             Return strTemp
> 
>         End Function
> 
> 
> ASPX
> Private Sub Button1_Click(ByVal sender As 

System.Object, ByVal e As 
> System.EventArgs) Handles Button1.Click
>         Dim test As String
> 
> 
>         Label1.Text = ChannelFrom.GetSelectedItemString
> 
> 
> 
>     End Sub





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to