Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Selected Item On Bound DDL

Reply
Thread Tools

Selected Item On Bound DDL

 
 
Randy Rubin
Guest
Posts: n/a
 
      07-15-2004
Does anyone know how to Make an Item selected in a DropDownListBox when
Binding it to data. When it changes it populates another TextBox but the
DDLB does not retain it's selected value.

Thanks

Randy


 
Reply With Quote
 
 
 
 
Ben
Guest
Posts: n/a
 
      07-15-2004
Don't rebind the control during selected index changed. If you must, store
the selected value, rebind it, then reapply the selected value.
"Randy Rubin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Does anyone know how to Make an Item selected in a DropDownListBox when
> Binding it to data. When it changes it populates another TextBox but the
> DDLB does not retain it's selected value.
>
> Thanks
>
> Randy
>
>




 
Reply With Quote
 
 
 
 
Randy Rubin
Guest
Posts: n/a
 
      07-15-2004
Still Not working.. Here is some code:
Sub Page_Load

If Not IsPostBack Then

lblNotes.Visible = True
txtNotes.Visible = False
btnUpdateNotes.Visible = False

Else
Session("ItemSel") = ddlItem.SelectedItem.Value
ddlItem.SelectedItem.Value = Session("ItemSel")
ddlItem.SelectedItem.Selected = True
End If
End Sub
"Ben" <(E-Mail Removed)> wrote in message
news:89BJc.93$(E-Mail Removed)...
> Don't rebind the control during selected index changed. If you must,

store
> the selected value, rebind it, then reapply the selected value.
> "Randy Rubin" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Does anyone know how to Make an Item selected in a DropDownListBox when
> > Binding it to data. When it changes it populates another TextBox but the
> > DDLB does not retain it's selected value.
> >
> > Thanks
> >
> > Randy
> >
> >

>
>
>



 
Reply With Quote
 
Norman Yuan
Guest
Posts: n/a
 
      07-15-2004
See comment inline

"Randy Rubin" <(E-Mail Removed)> wrote in message
news:uXro$(E-Mail Removed)...
> Still Not working.. Here is some code:
> Sub Page_Load
>
> If Not IsPostBack Then
>
> lblNotes.Visible = True
> txtNotes.Visible = False
> btnUpdateNotes.Visible = False
>
> Else


I think you should move the first line of code below to
ddlItem_SelectedIndexChanged event handler and erase the other two lines,
UNLESS you really want to ddlItem's selected item change to something else
other than user clicked item.

> Session("ItemSel") = ddlItem.SelectedItem.Value
> ddlItem.SelectedItem.Value = Session("ItemSel")
> ddlItem.SelectedItem.Selected = True
> End If
> End Sub
> "Ben" <(E-Mail Removed)> wrote in message
> news:89BJc.93$(E-Mail Removed)...
> > Don't rebind the control during selected index changed. If you must,

> store
> > the selected value, rebind it, then reapply the selected value.
> > "Randy Rubin" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Does anyone know how to Make an Item selected in a DropDownListBox

when
> > > Binding it to data. When it changes it populates another TextBox but

the
> > > DDLB does not retain it's selected value.
> > >
> > > Thanks
> > >
> > > Randy
> > >
> > >

> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help to fill textboxes from a selected item in datagrid-selected index changed. mldardy ASP .Net 0 09-28-2010 02:59 PM
Re: Setting 'selected' item in bound drop down list Marina ASP .Net 6 01-21-2008 04:33 PM
Showing img on page load based on DDL initial selected value Jim in Arizona ASP .Net 0 04-05-2007 05:20 PM
DropDownList 2 always returns Selected = 0 for all items - even selected item Iain ASP .Net 3 12-11-2006 11:07 AM
Re: Persisting DDL.SelectedValue or DDL.SelectedItem.Value without Viewstate Marina ASP .Net 0 08-12-2003 07:08 PM



Advertisments