how to reload data based on condition

Discussion in 'ASP .Net' started by =?Utf-8?B?U3VyZXNo?=, Nov 25, 2004.

  1. I have a combo and a datagrid in a page.
    Combo box values are loaded on page_Load.
    Datagrid is populated based on values selected in the combo (I am using
    selectedIndexchange event)

    I need to make a default value for the combo(first value available) and
    populate the datagrid based on this value on page_Load itself.(Applicable to
    many pages in my application)
    I tried changing the selectedindex = 1. But the change event is not firing.

    How can i achieve this without extra coding(As the system is in production)
    Thanks in advance.
    =?Utf-8?B?U3VyZXNo?=, Nov 25, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?U3VyZXNo?=

    Shiva Guest

    Setting SelectedIndex will not fire the event. Rather, call the
    DropDownList's SelectedIndexChanged event handler method directly on page
    load after setting SelectedIndex.

    "Suresh" <> wrote in message
    news:...
    I have a combo and a datagrid in a page.
    Combo box values are loaded on page_Load.
    Datagrid is populated based on values selected in the combo (I am using
    selectedIndexchange event)

    I need to make a default value for the combo(first value available) and
    populate the datagrid based on this value on page_Load itself.(Applicable to
    many pages in my application)
    I tried changing the selectedindex = 1. But the change event is not firing.

    How can i achieve this without extra coding(As the system is in production)
    Thanks in advance.
    Shiva, Nov 25, 2004
    #2
    1. Advertising

  3. I think u forgot to set the combo box properties "AutoPostback" to "true"

    1 more thing is the default index for combo should be start from "0"

    "Suresh" wrote:

    > I have a combo and a datagrid in a page.
    > Combo box values are loaded on page_Load.
    > Datagrid is populated based on values selected in the combo (I am using
    > selectedIndexchange event)
    >
    > I need to make a default value for the combo(first value available) and
    > populate the datagrid based on this value on page_Load itself.(Applicable to
    > many pages in my application)
    > I tried changing the selectedindex = 1. But the change event is not firing.
    >
    > How can i achieve this without extra coding(As the system is in production)
    > Thanks in advance.
    =?Utf-8?B?TG9r?=, Nov 25, 2004
    #3
  4. Hi suresh,

    As a work around for your problem u can explicitly call the selected
    indexchanged event handler as soon as you set the selected index to 1

    combobox_SelectedIndexChanged(Nothing, Nothing)

    Hope this helps


    "Suresh" wrote:

    > I have a combo and a datagrid in a page.
    > Combo box values are loaded on page_Load.
    > Datagrid is populated based on values selected in the combo (I am using
    > selectedIndexchange event)
    >
    > I need to make a default value for the combo(first value available) and
    > populate the datagrid based on this value on page_Load itself.(Applicable to
    > many pages in my application)
    > I tried changing the selectedindex = 1. But the change event is not firing.
    >
    > How can i achieve this without extra coding(As the system is in production)
    > Thanks in advance.
    =?Utf-8?B?c3VyZXNoIGthbm5hbg==?=, Nov 25, 2004
    #4
    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. -
    Replies:
    12
    Views:
    676
    Remon van Vliet
    Jun 15, 2005
  2. Joshua Beall
    Replies:
    26
    Views:
    219,904
    AndreiKaa
    Jun 29, 2007
  3. gen_tricomi
    Replies:
    2
    Views:
    724
    gen_tricomi
    May 23, 2006
  4. Pathik
    Replies:
    1
    Views:
    338
    Martin Honnen
    Apr 2, 2007
  5. Bill W.
    Replies:
    13
    Views:
    280
    Phillip Gawlowski
    May 9, 2011
Loading...

Share This Page