Click here to Skip to main content
15,794,593 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to pass data from aspx page to html page in can give this solution


you can pass data from aspx page to html page in method like GET

Let me show you sample code for that


And testing.htm page has following code

<html xmlns="">
    <script language ="javascript" >
function GetParam(name) {

  if (start<0)"&"+name+"=");
  if (start<0) return '';
  start += name.length+2;
  if (end<0);
  var result='';
  for(var i=start;i<=end;i++) {
    result=result+(c=='+'?' ':c);
  return unescape(result);

function f1() {
    document.getElementById("resdiv").innerHTML = GetParam('val1');
<body onload ="f1()">
<div id="resdiv"></div>


you can pass values by using above code

All the Best
Share this answer
Amir Mahfoozi 16-Oct-11 7:34am    
You're right ! +5
Kishor Khatri 2-Jun-16 5:58am    
Thank You Muralikrishna8811, i was also facing same issue, Thank You :)
You can't access the variable that are local to the page, they need to made public.

Accessing the properties defined in the code-behind your HTML you need to define your properties or variables as public, and then call like this...

<%= this.MyVariable %>

You could also use Literals.
In the ASP Part use...
<asp:literalcontrol runat="server" id="LiteralControl" xmlns:asp="#unknown">

And in the code behind use...
LiteralControl.Text = "<table><tr>...etc";</tr></table>

Hope this helps.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900