Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting a drop down list on a webpage

Status
Not open for further replies.

sajidi99

Programmer
Jun 7, 2005
53
SE
Hi,

Does anyone know how to select (or Activate/Highlight) a Drop Down List in the C # code behind?

Thx
Saj
 
What do you mean with "select"? Give it focus pressing tab key or hiting a button ??
 

Hi,

Thx for reply.

Yes I mean "give it focus".

I want to do this in an image button click event of the Code Behind.

Thx
Saj
 
yeah i think he does, u have to use focus() method...

Known is handfull, Unknown is worldfull
 

Hi vbkris,

"Known is handfull, Unknown is worldfull"

wat that means dude?

Yes, javascript focus method will do .... but how in the click event??

Cheers
Saj
 
Use Attributes.Add


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
e.g.:
<body onload="document.forms[0].ASD.focus()">



ASD must be the name of the control.

Warning:
this metod will not work if ASD is a sub control (e.g: within a datagrid). to overcome it i guess u have to use the ClientId method...

Known is handfull, Unknown is worldfull
 
hi vbkris,

thx for reply

I know wat u mean but
the problem is that, i want to focus this from Code Behind ... (after performing some operations on server)

Cheers
Saj
 
generate the script in code behind, i.e. use


Page.RegisterStartupScript(1,"<script>document.forms[0].ASD.focus()</script>")


Known is handfull, Unknown is worldfull
 
no problemmo...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top