[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How to get access to the DOM in code behind page?

Posted on 2008-01-29
3
Medium Priority
?
310 Views
Last Modified: 2013-11-26
Is it possible to gain access to the document object model of the browser via a code behind page (asp.net 1.1/2003)?
0
Comment
Question by:bobinorlando
  • 2
3 Comments
 
LVL 38

Expert Comment

by:PaulHews
ID: 20777545
The DOM is a client side object.  You can only access server elements on the server.  Give us an idea what you are trying to do, and we may be able to suggest an approach.
0
 
LVL 1

Author Comment

by:bobinorlando
ID: 20782682
To the same extent that you can read and write to the model in the client, I want to be able to do the same in the code behind. I imagine this would involve passing values back and forth between some js and the server side code. In general, what are the various approaches that are available?
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 2000 total points
ID: 20789427
It's a broad question.  There are any number of ways to send information back and forth from client to server.  Off the top of my head:

You can use placeholders to add specific HTML to a page from server side.
You can add literal javascript using RegisterClientScriptBlock:

Dim scriptLiteral As String = "... content of script here"
ClientScript.RegisterClientScriptBlock(GetType(Default_), "InitScript", scriptLiteral)

When registering client side script, you can embed server control IDs using ClientID

You can include classic ASP style output with your HTML (although remember that it's harder to maintain this way.)

<% If IncludeStuff=True %>
Put stuff here
<% End If %>

-Postback from client side
http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx




0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Suggested Courses
Course of the Month11 days, 4 hours left to enroll

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question