Groups | Blog | Home
all groups > asp.net > may 2004 >

asp.net : accessing server control properties from client


chauncy
5/28/2004 10:28:44 PM
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.

Rich
5/29/2004 3:51:02 PM
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:

Shaul Feldman
5/30/2004 3:06:22 PM
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
[quoted text, click to view]
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:
[quoted text, click to view]

AddThis Social Bookmark Button