populate FormView fields from a DropDownList

Discussion in 'ASP .Net' started by mkidd, Jan 14, 2008.

  1. mkidd

    mkidd Guest

    Hi,

    I'm trying to build an online form using asp.net and vb.net for the
    code behind in Visual Studio 2005.

    I want to fill 3 fields in a FormView that's connected to one table
    (table1) with information from another table (table2) by choosing the
    key field from table2 in a DropDownList.

    Table2 has 3 fields with info that doesn't change (name, phone# and
    email for about 5 customer service reps). I want each rep to choose
    their name in the DropDownList to populate those fields in the
    FormView.

    I'm connecting to the sql db with an ObjectDataSource.

    I'm thinking I just need to put some VB code into the
    SelectedIndexChanged event of the ddl, something like:

    *something goes here* = DropDownList1.SelectedValue.ToString()

    But I'm drawing a blank on what would go to the left of the equal
    sign.

    Thanks in advance for the help.
    mkidd, Jan 14, 2008
    #1
    1. Advertising

  2. myFormView.FindControl("myControlId") will find the control if it is in the
    template the formview is going to present. Otherwise you may need to do
    something like myFormView.EditItemTemplate.FindControl("myControlId").

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "mkidd" <> wrote in message
    news:...
    > Hi,
    >
    > I'm trying to build an online form using asp.net and vb.net for the
    > code behind in Visual Studio 2005.
    >
    > I want to fill 3 fields in a FormView that's connected to one table
    > (table1) with information from another table (table2) by choosing the
    > key field from table2 in a DropDownList.
    >
    > Table2 has 3 fields with info that doesn't change (name, phone# and
    > email for about 5 customer service reps). I want each rep to choose
    > their name in the DropDownList to populate those fields in the
    > FormView.
    >
    > I'm connecting to the sql db with an ObjectDataSource.
    >
    > I'm thinking I just need to put some VB code into the
    > SelectedIndexChanged event of the ddl, something like:
    >
    > *something goes here* = DropDownList1.SelectedValue.ToString()
    >
    > But I'm drawing a blank on what would go to the left of the equal
    > sign.
    >
    > Thanks in advance for the help.
    Eliyahu Goldin, Jan 14, 2008
    #2
    1. Advertising

  3. mkidd

    mkidd Guest

    Thanks, but can you help me with what to do to write the data from the
    DropDownList table to the FormView after the FindControl event? I'm
    really new at this.

    On Jan 14, 9:15 am, "Eliyahu Goldin"
    <> wrote:
    > myFormView.FindControl("myControlId") will find the control if it is in the
    > template the formview is going to present. Otherwise you may need to do
    > something like myFormView.EditItemTemplate.FindControl("myControlId").
    >
    > --
    > Eliyahu Goldin,
    > Software Developer
    > Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
    >
    > "mkidd" <> wrote in message
    >
    > news:...
    >
    > > Hi,

    >
    > > I'm trying to build an online form using asp.net and vb.net for the
    > > code behind in Visual Studio 2005.

    >
    > > I want to fill 3 fields in a FormView that's connected to one table
    > > (table1) with information from another table (table2) by choosing the
    > > key field from table2 in a DropDownList.

    >
    > > Table2 has 3 fields with info that doesn't change (name, phone# and
    > > email for about 5 customer service reps). I want each rep to choose
    > > their name in the DropDownList to populate those fields in the
    > > FormView.

    >
    > > I'm connecting to the sql db with an ObjectDataSource.

    >
    > > I'm thinking I just need to put some VB code into the
    > > SelectedIndexChanged event of the ddl, something like:

    >
    > > *something goes here* = DropDownList1.SelectedValue.ToString()

    >
    > > But I'm drawing a blank on what would go to the left of the equal
    > > sign.

    >
    > > Thanks in advance for the help.
    mkidd, Jan 15, 2008
    #3
    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. mr2_93
    Replies:
    1
    Views:
    3,582
    mr2_93
    Oct 2, 2005
  2. jobs at webdos
    Replies:
    0
    Views:
    686
    jobs at webdos
    Oct 9, 2006
  3. Satish
    Replies:
    8
    Views:
    9,621
    Satish
    Mar 31, 2008
  4. jobs at webdos
    Replies:
    0
    Views:
    445
    jobs at webdos
    Oct 9, 2006
  5. Enjoy Life
    Replies:
    2
    Views:
    256
    Roland Hall
    Feb 23, 2005
Loading...

Share This Page