accessing server control properties from client

  • Thread starter Thread starter chauncy
  • Start date Start date
C

chauncy

Hi,

I have a databound dropdown filled with data.
The text value is a file path that I want to use to open that file in
a new browser window.

I can do this with a html dropdown because I can access
the properties of that control from javascript.

document.form.mydd.value

put that in a variable and open a new window


How to do this with a server control type drop down?? It's properties
don't seem to be available in clientside js.

Help.
 
Hi,
I would suggest an another approach: define a global JavaScript variable and
assign the value from the server side code. If you're using an object that
for instance resides in some user control, you'll get the full Client-side
id of the object with OBJECT.ClientID property. To assign value to
javascript variable I'd do something like RegisterScriptBlock and run
document.getElementById on the .ClientID property. A bit messy, but works
100%, and doesn't metter if you have UC or you don't.

--
With the best wishes,
Shaul Feldman
Rich said:
Run your page. Then, got into View Source in the browser. You'll see
specifically how that control was rendered, ie. exactly how it appears in
the HTML document. From that, you should be able to figure out how to
address it from script. As you may know, this involves the DHTML:
 
Back
Top