FormView DropdownList - On Selection Change populate Text Box

Discussion in 'ASP .Net' started by Satish, Mar 28, 2008.

  1. Satish

    Satish Guest

    C#, ASP.NET
    Q: Have a formview, with a dropdownlist which is bound to a column. This
    dropdownlist has a datasource of DataSet type. Now my objective is, on
    Selection Changed of this DropdownList, I need to populate a couple of
    TextBox's. How can I do this? What event does the code go into? The
    selectionindexchanged even for the DropDownList does not seem to fire.

    Any help is appreciated.

    Thanks in advance.
     
    Satish, Mar 28, 2008
    #1
    1. Advertising

  2. Satish

    Just Me Guest

    The selectIndexChanged event absolutely should fire. However, if you are
    expecting it to cause a postback when you change the selection, you need to
    set the AutoPostback property= true in the properties for this control.

    Once you have got the event fireing its jsut a matter of writing your code
    based on the selected index data.

    HTH




    "Satish" <> wrote in message
    news:...
    > C#, ASP.NET
    > Q: Have a formview, with a dropdownlist which is bound to a column. This
    > dropdownlist has a datasource of DataSet type. Now my objective is, on
    > Selection Changed of this DropdownList, I need to populate a couple of
    > TextBox's. How can I do this? What event does the code go into? The
    > selectionindexchanged even for the DropDownList does not seem to fire.
    >
    > Any help is appreciated.
    >
    > Thanks in advance.
    >
     
    Just Me, Mar 28, 2008
    #2
    1. Advertising

  3. Satish

    Satish Guest

    Nope, tried adding code in SelectionIndexChanged Event and even tried with
    the Debugger, nothing.

    "Satish" wrote:

    > C#, ASP.NET
    > Q: Have a formview, with a dropdownlist which is bound to a column. This
    > dropdownlist has a datasource of DataSet type. Now my objective is, on
    > Selection Changed of this DropdownList, I need to populate a couple of
    > TextBox's. How can I do this? What event does the code go into? The
    > selectionindexchanged even for the DropDownList does not seem to fire.
    >
    > Any help is appreciated.
    >
    > Thanks in advance.
    >
     
    Satish, Mar 28, 2008
    #3
  4. Satish

    Just Me Guest

    Does your page_load event fire ?, if not, check that your Autowireup event
    is set to true. Also, you didnt comment on the Autopostback I mentioned have
    you checked this.

    Whatever you problem is, its likely to be very basic.



    "Satish" <> wrote in message
    news:...
    > Nope, tried adding code in SelectionIndexChanged Event and even tried with
    > the Debugger, nothing.
    >
    > "Satish" wrote:
    >
    >> C#, ASP.NET
    >> Q: Have a formview, with a dropdownlist which is bound to a column. This
    >> dropdownlist has a datasource of DataSet type. Now my objective is, on
    >> Selection Changed of this DropdownList, I need to populate a couple of
    >> TextBox's. How can I do this? What event does the code go into? The
    >> selectionindexchanged even for the DropDownList does not seem to fire.
    >>
    >> Any help is appreciated.
    >>
    >> Thanks in advance.
    >>
     
    Just Me, Mar 28, 2008
    #4
  5. Satish

    Just Me Guest

    Should read "Autowireup" @page property


    "Just Me" <news.microsoft.com> wrote in message
    news:...
    >
    > Does your page_load event fire ?, if not, check that your Autowireup event
    > is set to true. Also, you didnt comment on the Autopostback I mentioned
    > have you checked this.
    >
    > Whatever you problem is, its likely to be very basic.
    >
    >
    >
    > "Satish" <> wrote in message
    > news:...
    >> Nope, tried adding code in SelectionIndexChanged Event and even tried
    >> with
    >> the Debugger, nothing.
    >>
    >> "Satish" wrote:
    >>
    >>> C#, ASP.NET
    >>> Q: Have a formview, with a dropdownlist which is bound to a column. This
    >>> dropdownlist has a datasource of DataSet type. Now my objective is, on
    >>> Selection Changed of this DropdownList, I need to populate a couple of
    >>> TextBox's. How can I do this? What event does the code go into? The
    >>> selectionindexchanged even for the DropDownList does not seem to fire.
    >>>
    >>> Any help is appreciated.
    >>>
    >>> Thanks in advance.
    >>>

    >
    >
     
    Just Me, Mar 28, 2008
    #5
  6. Satish

    Stan Guest

    On 28 Mar, 20:50, "Just Me" <news.microsoft.com> wrote:
    > The selectIndexChanged event absolutely should fire. However, if you are
    > expecting it to cause a postback when you change the selection, you need to
    > set the AutoPostback property= true in the properties for this control.
    >
    > Once you have got the event fireing its jsut a matter of writing your code
    > based on the selected index data.
    >
    > HTH
    >
    > "Satish" <> wrote in message
    >
    > news:...
    >
    >
    >
    > > C#, ASP.NET
    > > Q: Have a formview, with a dropdownlist which is bound to a column. This
    > > dropdownlist has a datasource of DataSet type. Now my objective is, on
    > > Selection Changed of this DropdownList, I need to populate a couple of
    > > TextBox's. How can I do this? What event does the code go into? The
    > > selectionindexchanged even for the DropDownList does not seem to fire.

    >
    > > Any help is appreciated.

    >
    > > Thanks in advance.- Hide quoted text -

    >
    > - Show quoted text -


    Unfortunately, even when AutoPostback is enabled on a drop-downlist it
    won't trigger a postback unless the selected value is *different* from
    the previous one (or unless the SelectedIndex property actually
    changes). Merely clicking on it will not do the trick.

    This exposes a fundamental problem with Satish's design. Since the DDL
    is preloaded with data it will not necessarily work in the intended
    fashion. The best approach is to preload the other controls with
    relevent data (based on the initial selection) during the FormView
    DataBound event.
     
    Stan, Mar 29, 2008
    #6
  7. Satish

    Just Me Guest

    With respect, I think you have missed the point. See my comments in
    stars.***

    >> The selectIndexChanged event absolutely should fire. However, if you are
    >> expecting it to cause a postback when you **** change the selection ****
    >> , you need to



    "Stan" <> wrote in message
    news:...
    > On 28 Mar, 20:50, "Just Me" <news.microsoft.com> wrote:
    >> The selectIndexChanged event absolutely should fire. However, if you are
    >> expecting it to cause a postback when you change the selection, you need
    >> to
    >> set the AutoPostback property= true in the properties for this control.
    >>
    >> Once you have got the event fireing its jsut a matter of writing your
    >> code
    >> based on the selected index data.
    >>
    >> HTH
    >>
    >> "Satish" <> wrote in message
    >>
    >> news:...
    >>
    >>
    >>
    >> > C#, ASP.NET
    >> > Q: Have a formview, with a dropdownlist which is bound to a column.
    >> > This
    >> > dropdownlist has a datasource of DataSet type. Now my objective is, on
    >> > Selection Changed of this DropdownList, I need to populate a couple of
    >> > TextBox's. How can I do this? What event does the code go into? The
    >> > selectionindexchanged even for the DropDownList does not seem to fire.

    >>
    >> > Any help is appreciated.

    >>
    >> > Thanks in advance.- Hide quoted text -

    >>
    >> - Show quoted text -

    >
    > Unfortunately, even when AutoPostback is enabled on a drop-downlist it
    > won't trigger a postback unless the selected value is *different* from
    > the previous one (or unless the SelectedIndex property actually
    > changes). Merely clicking on it will not do the trick.
    >
    > This exposes a fundamental problem with Satish's design. Since the DDL
    > is preloaded with data it will not necessarily work in the intended
    > fashion. The best approach is to preload the other controls with
    > relevent data (based on the initial selection) during the FormView
    > DataBound event.
     
    Just Me, Mar 29, 2008
    #7
  8. Satish

    Guest

    On Mar 28, 3:44 pm, Satish <> wrote:
    > C#, ASP.NET
    > Q: Have a formview, with a dropdownlist which is bound to a column. This
    > dropdownlist has a datasource of DataSet type. Now my objective is, on
    > Selection Changed of this DropdownList, I need to populate a couple of
    > TextBox's. How can I do this? What event does the code go into? The
    > selectionindexchanged even for the DropDownList does not seem to fire.
    >
    > Any help is appreciated.
    >
    > Thanks in advance.


    why not use javascipt?
    if you have element, for example, like this:
    <select id="selectDriveList"
    onchange="change_drive(this.options[this.selectedIndex].value);">
    <option .....>
    <option ....>
    </select>

    then javascript:
    <script>
    function change_drive( drive_letter )
    {
    document.getElementById("textTextBox1").value ="user selected " +
    drive_letter;
    }
    </script>

    no?


    ... more at http://www.siccolo.com/articles.asp
     
    , Mar 29, 2008
    #8
  9. Satish

    Satish Guest

    Page load fires, regardless of Postback - true/false.

    However, the selectionindexchanged event just does not fire.
    I read thru the AutoEventWireup attribute and made sure that it is set to
    true everywhere, webconfig as well as the aspx page itself.

    I am also using VS2008.

    "Just Me" wrote:

    > Should read "Autowireup" @page property
    >
    >
    > "Just Me" <news.microsoft.com> wrote in message
    > news:...
    > >
    > > Does your page_load event fire ?, if not, check that your Autowireup event
    > > is set to true. Also, you didnt comment on the Autopostback I mentioned
    > > have you checked this.
    > >
    > > Whatever you problem is, its likely to be very basic.
    > >
    > >
    > >
    > > "Satish" <> wrote in message
    > > news:...
    > >> Nope, tried adding code in SelectionIndexChanged Event and even tried
    > >> with
    > >> the Debugger, nothing.
    > >>
    > >> "Satish" wrote:
    > >>
    > >>> C#, ASP.NET
    > >>> Q: Have a formview, with a dropdownlist which is bound to a column. This
    > >>> dropdownlist has a datasource of DataSet type. Now my objective is, on
    > >>> Selection Changed of this DropdownList, I need to populate a couple of
    > >>> TextBox's. How can I do this? What event does the code go into? The
    > >>> selectionindexchanged even for the DropDownList does not seem to fire.
    > >>>
    > >>> Any help is appreciated.
    > >>>
    > >>> Thanks in advance.
    > >>>

    > >
    > >

    >
    >
    >
     
    Satish, Mar 31, 2008
    #9
    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. jobs at webdos
    Replies:
    0
    Views:
    704
    jobs at webdos
    Oct 9, 2006
  2. mkidd
    Replies:
    2
    Views:
    987
    mkidd
    Jan 15, 2008
  3. jobs at webdos
    Replies:
    0
    Views:
    485
    jobs at webdos
    Oct 9, 2006
  4. Adrian
    Replies:
    1
    Views:
    230
    Bullschmidt
    Feb 18, 2004
  5. Loebb
    Replies:
    0
    Views:
    205
    Loebb
    Feb 23, 2004
Loading...

Share This Page