views:

16

answers:

1

Hello all.

I have a scenario whereby I have a textbox with an autocomplete extender attached and two drop down lists; this enables a user to search for product info.

Ideally I'd like to create something that effectivley, 'resets' the drop downs so that when a user clicks on the textbox (maybe I'll do it 'onenter'/'ondelete' if there is such a thing).

I've had a look at .Attributes.Add but cannae figure it out.

How do you include asp.net controls within this scenario so I could have something along the lines of:

tbxAutoComplete.Attributes.Add("OnClick", ddlLevelAuto.SelectedIndex = 0, ddlItemCategory.SelectedIndex = 0,);

I obviously know this doesn't work as I'm whilst banging my head on my desk : )

Any help, gratefully received.

A: 

Hey,

You can't use server-side code to reset; you need client-side JavaScript code to do this. You can reset a drop down by setting

ddl.selectedIndex = 0;

in javascript, when the textbox fires its focus client-side event.

HTH.

Brian