?
Solved

Can I set a hidden (or other) field on an HTML page from a ASP.NET session variable

Posted on 2005-03-24
9
Medium Priority
?
286 Views
Last Modified: 2010-04-07
Hi,

I have a number of similar questions posted here at the moment as im considering different ways of solving my problem.

I have a value in a ASP.NET session variable that I need to access from the HTML page.  Is there any way (maybe in the onload event?!) of transferring that value to the HTML page?

I dont need this at run time just when it gets loaded/reloaded.

Thanks.

James.
0
Comment
Question by:JAMES
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 

Expert Comment

by:pbailey100
ID: 13621267
if you want to set a value in the hidden field try placing this code in the html

<input id="Hidden1" type="hidden" value='<%= Session("MyValue") %>' />

Hope this helps
0
 
LVL 9

Expert Comment

by:Type25
ID: 13621521
Sure...

OnLoadEvent
---------------

myHiddenField.Value = Session("MyValue")

HTML
-----

<input type=hidden id=myHiddenField runat=server>
0
 

Author Comment

by:JAMES
ID: 13621561
Type25,

How is that transferring the value in an apsx page session variable to the HTML page?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 26

Assisted Solution

by:Rejojohny
Rejojohny earned 1000 total points
ID: 13621699
is the HTML page loaded within frames and does the other frames have aspx pages .. if s .. then u can do it in the load event of the aspx pages to fill the value .. if the HTML page is loaded on its own .. then u cannot do what u have requested .. change the HTML page to an aspx page .. am sure that will not hamper ur exiting code in that page (if u have any)
0
 
LVL 9

Accepted Solution

by:
Type25 earned 1000 total points
ID: 13621731
OK, if you mean transferring the value to HTML page:

pageload in aspx
-------------------

Page.RegisterStartupScript("fillValue", "<script>document.getElementById('myHiddenText').value = " + Session("myvalue") + ";</script>");
0
 

Author Comment

by:JAMES
ID: 13622101
Rejo,

Interesting thought -change to an aspx page...

We dynamically create a frameset within the HTML page - can this be done in a aspx page?
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 13622168
how do u dynamically create a frameset .. using document.write statements? anyway all HTML/client scripts that u have writte in HTML page can be used in the aspx page too ...
0
 

Author Comment

by:JAMES
ID: 13622485
Just converted to ASPX and so far so good.  This might solve all my problems is getting information to and from pages without using damn cookies....

I will post back after testing.....
0
 

Author Comment

by:JAMES
ID: 13628684
I am going to split points as Type25 gave me an an answer but Rejo gave me the idea the change my html to an aspx page (which has helped me in a number of ways).

Hope you both agree.

Many thanks.

James.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

770 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