SelectedIndex in DropDownList....Please help, this is driving me crazy.....

Discussion in 'ASP .Net' started by Joe Blanchard via .NET 247, May 15, 2005.

  1. Hello,

    Can someone please help me. I thought this would be simple but so far nothing I try works.....

    I've got a simple update page. On this page I have a datalist bound by data from a SQL Server table. I used the standard:

    MyDataList.DataSource = objDS
    MyDataList.DataBind()

    inside a sub to bind the data on pageload.




    In this datalist I have a dropdownlist. All I want to do is have the SelectedIndex of my dropdownlist display the value from the one field (varchar) from the table defined by my SELECT statement.

    Nothing I do seems to work. If it helps, I could pull the dropdownlist out of the datalist and bind directly to that if it would be easier. Can someone please lend an ear hear.........

    Many thanx

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>aCdp5BY3C0qbRCU9A/dLOQ==</Id>
     
    Joe Blanchard via .NET 247, May 15, 2005
    #1
    1. Advertising

  2. You need to handle ItemDataBound event to set SelectedIndes
    programmatically.

    Eliyahu

    "Joe Blanchard via .NET 247" <> wrote in message
    news:uO$...
    > Hello,
    >
    > Can someone please help me. I thought this would be simple but so far

    nothing I try works.....
    >
    > I've got a simple update page. On this page I have a datalist bound by

    data from a SQL Server table. I used the standard:
    >
    > MyDataList.DataSource = objDS
    > MyDataList.DataBind()
    >
    > inside a sub to bind the data on pageload.
    >
    >
    >
    >
    > In this datalist I have a dropdownlist. All I want to do is have the

    SelectedIndex of my dropdownlist display the value from the one field
    (varchar) from the table defined by my SELECT statement.
    >
    > Nothing I do seems to work. If it helps, I could pull the dropdownlist out

    of the datalist and bind directly to that if it would be easier. Can someone
    please lend an ear hear.........
    >
    > Many thanx
    >
    > -----------------------
    > Posted by a user from .NET 247 (http://www.dotnet247.com/)
    >
    > <Id>aCdp5BY3C0qbRCU9A/dLOQ==</Id>
     
    Eliyahu Goldin, May 15, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William Gower

    ItemTemplate error driving me crazy

    William Gower, Apr 23, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    328
    William Gower
    Apr 23, 2004
  2. Replies:
    1
    Views:
    493
    Cowboy \(Gregory A. Beamer\)
    Dec 5, 2005
  3. Miguel Dias Moura
    Replies:
    1
    Views:
    4,503
    Kalpesh
    Mar 20, 2006
  4. Giuseppe Turitto

    IE it's driving me crazy, I need some help

    Giuseppe Turitto, Sep 11, 2007, in forum: HTML
    Replies:
    2
    Views:
    392
    Jim Moe
    Sep 11, 2007
  5. Ken Varn

    ViewState is driving me crazy. Please help!

    Ken Varn, Apr 20, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    104
    Scott Mitchell [MVP]
    Apr 21, 2004
Loading...

Share This Page