Home All Groups Group Topic Archive Search About

DropdownLisr problem on postback

Author
28 Jul 2006 12:28 AM
Herman_Geovany_Ayala_Zúñiga
Hi.

I working with dropdownlist control, this control is populated with a
collection. when the page has a postback i tried to get the new
selectedindex that the user select but always is 0. What happening? What
can i do? this control doný fire teh postback.

Regards

Author
28 Jul 2006 3:12 AM
Chison Cai
HI,
    Is it running the "DataBinding" code to re-bind the dropdownlist when
the page is postback ?

Show quoteHide quote
"Herman Geovany Ayala Zúñiga" <geovanyay***@gmail.com>
:Oxy4CzdsGHA.1***@TK2MSFTNGP05.phx.gbl...
> Hi.
>
> I working with dropdownlist control, this control is populated with a
> collection. when the page has a postback i tried to get the new
> selectedindex that the user select but always is 0. What happening? What
> can i do? this control doný fire teh postback.
>
> Regards
Author
28 Jul 2006 6:35 PM
Herman_Geovany_Ayala_Zúñiga
Chison Cai escribió:
Show quoteHide quote
> HI,
>     Is it running the "DataBinding" code to re-bind the dropdownlist when
> the page is postback ?
>
> "Herman Geovany Ayala Zúñiga" <geovanyay***@gmail.com>
> :Oxy4CzdsGHA.1***@TK2MSFTNGP05.phx.gbl...
>> Hi.
>>
>> I working with dropdownlist control, this control is populated with a
>> collection. when the page has a postback i tried to get the new
>> selectedindex that the user select but always is 0. What happening? What
>> can i do? this control doný fire teh postback.
>>
>> Regards
>
>
I do that to populate again the dropdownlist but i want to get the
selectedindex when the postback fires

regards
Author
29 Jul 2006 5:54 AM
Chison Cai
You should NOT re-bind the dropdownlist when the page is postback...
cos it will refresh the dropdownlist's DataSource and reset the
selectedindex to 0 .

you just need to have data binded when the page is not PostBack.
like this:

private void Page_Load(object sender, System.EventArgs e)
{
   if (!Page.IsPostBack)
   {
       //binding dropdownlist
   }
}

holp it helps

Regards,
chison

Show quoteHide quote
"Herman Geovany Ayala Zúñiga" <geovanyay***@gmail.com>
:eiNbuSnsGHA.4***@TK2MSFTNGP02.phx.gbl...
> Chison Cai escribió:
>> HI,
>>     Is it running the "DataBinding" code to re-bind the dropdownlist when
>> the page is postback ?
>>
>> "Herman Geovany Ayala Zúñiga" <geovanyay***@gmail.com>
>> :Oxy4CzdsGHA.1***@TK2MSFTNGP05.phx.gbl...
>>> Hi.
>>>
>>> I working with dropdownlist control, this control is populated with a
>>> collection. when the page has a postback i tried to get the new
>>> selectedindex that the user select but always is 0. What happening? What
>>> can i do? this control doný fire teh postback.
>>>
>>> Regards
>>
>>
> I do that to populate again the dropdownlist but i want to get the
> selectedindex when the postback fires
>
> regards