Those would be reasons number 4, 7, and 16 for the creation of
EasyListBox :)  No viewstate necessary for selection persistence, a
comma-delimited string available by default, and you can specify
dropdown/listbox/combo at run time (for your question on the other
thread).

        By the way, if for some reason you want to re-bind your listbox
-- for example, to get the most current data or if you have a long list
and don't want to post all that junk back to the server -- you can
disable Viewstate, grab Request.Form("listBoxName"), and re-select the
item(s) after you databind.'

Cheers,

Peter

-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of kindawords

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