Hi Ravindra,

Thanks for your reply. I tried using this:

Dim item as ListItem = dd.items.FindByValue(value)
item.Selected = "True"

However item is always Nothing (an yes, I checked if value was in the
DropDownList and it is). I have no idea what is wrong. I tried
ddl.selectedValue = value and ddl.SelectedIndex = index and didn't
work neither. I don't understand why the value in my dropDownList is
not being set! This dropDownList is inside a FormView and it's bound
when a new record is about to be inserted and when a record is about
to be edited. If you have any suggestions about what can be wrong,
please let me know.

Thanks a lot,

Ana




On May 24, 3:44 am, ravindra kumar <[email protected]> wrote:
> use ddl.items.findbyvalue('val').selected=true;
>
>
>
> On Sat, May 22, 2010 at 1:20 AM, Ana <[email protected]> wrote:
> > Hi Keidrick,
>
> > Thanks for your reply. I took a look at the link you sent, but that's
> > exactly what I'm doing. The problem is that when I try to set the
> > selected value, it is not changed and I can't see why. Can you help me
> > with this?
>
> > Ana
>
> > On May 21, 1:07 pm, KeidrickP <[email protected]> wrote:
> > > take a look at thishttp://
> > msdn.microsoft.com/en-us/library/a5kfekd2%28v=VS.85%29.aspx
>
> > > you can get the selected item or the selected value.
>
> > > On Fri, May 21, 2010 at 1:59 PM, Ana <[email protected]>
> > wrote:
> > > > Hi, I have the following code:
>
> > > > Protected Sub MyDropDownList_DataBound(ByVal sender As Object, ByVal e
> > > > As System.EventArgs)
> > > >        Dim drv As DataRowView = MRFormView.DataItem
> > > >        Dim ddlValue As String = drv("value")
> > > >        Dim ddl As DropDownList = sender
>
> > > >        If Not IsDBNull(ddlValue) Then
> > > >            ddl.SelectedValue = ddlValue
> > > >        End If
> > > >    End Sub
>
> > > > Let's say  ddlValue = 100. While debugging, when I check the value for
> > > > ddlSelectedValue after the line ddl.SelectedValue = ddlValue,
> > > > ddl.SelectedValue is and empty String "", even though ddlValue = 100.
>
> > > > I know this must be something very simple that are missing, but anyone
> > > > have any suggestions of what is happening?
>
> > > > I appreciate your help!
>
> > > > Ana
>
> > > --
> > > Keidrick Pettaway
>
> > >http://kpettaway.com
>
> --
> Ravindra kumar
> delhi

Reply via email to