?
Solved

Display criteria change without refreshing whole page in asp.net

Posted on 2011-02-15
10
Medium Priority
?
500 Views
Last Modified: 2012-05-11
Hi everyone.

Can anyone help me with the above.

What i am trying to do is have a page that is displayed within another page (<!-- #include-->), however, depending on what they click, i want the page to refresh just the include page with the new criteria, but if the click another part of the included page, it takes them to another page.

Can any help me please

Baker
0
Comment
Question by:Bakersville
[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
10 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 34895760
you need to use iframes

<div class="iframeContainer">
  <iframe src="newPageTobeIncluded.html"/>
<div>
0
 
LVL 1

Author Comment

by:Bakersville
ID: 34895787
Thank you gurvinder372, i really want to keep away from iframes as must of the browsers dont support them.

There really is no way of doing it without?
0
 
LVL 5

Expert Comment

by:_-MYFOX-_
ID: 34895815
The best way to make and keep the code clean (ie without the iframe) is using  ajax ...
0
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.

 
LVL 1

Author Comment

by:Bakersville
ID: 34895842
Thank you MYfox.

Can you help me how to do this?

Lets say i have a include page in the middle of the webpage and it is already pointing to default.aspx?pageid=1

Now if you click on a link that then displays default.aspx?pageid=1&mysite=me&do=uk

Thanks
0
 
LVL 20

Expert Comment

by:Proculopsis
ID: 34895919

You might want to consider an ajax solution:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_26821974.html</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">

jQuery(document).ready( function () {

  $(".dynamic").click( getContent );

});

function getContent( event ) {
  event.preventDefault();
  $("#dynamic-content").load( $(this).attr( "href" ) );
}

</script>

<style>
#dynamic-content { width: 640px; height: 400px; border: 1px dotted #f00; margin-left: auto; margin-right: auto; overflow: scroll; background-color: beige; }
</style>

</head>
<body>

<a href="http://www.whatcar.com/Valuation/SelectMake?makeId=4708" class="dynamic">Alfa Romeo</a> |
<a href="http://www.whatcar.com/valuation/SelectMake?makeId=5202" class="dynamic">Aston Martin</a> |
<a href="http://www.whatcar.com/valuation/SelectMake?makeId=5289" class="dynamic">Audi</a> |
<a href="http://www.whatcar.com/valuation/SelectMake?makeId=28656" class="dynamic">Bentley</a> |
<a href="http://www.whatcar.com/valuation/SelectMake?makeId=6805" class="dynamic">BMW</a>

<div id="dynamic-content"></div>

</body>
</html>

Open in new window

0
 
LVL 5

Accepted Solution

by:
_-MYFOX-_ earned 1000 total points
ID: 34896451
0
 
LVL 14

Assisted Solution

by:Dhanasekaran Sengodan
Dhanasekaran Sengodan earned 1000 total points
ID: 34896482
0
 
LVL 1

Author Comment

by:Bakersville
ID: 34917698
Hi everyone.

I have been trying to get it to work with very little luck, so spent more time researching and come up with a solution from w3schools, however, i have changed the code but still can not get it to work.

I have my file in asp.net, if quesrystring = me, me1 or me2 then i should display something

If Request.QueryString("q") = "me" Then
            Response.Write("Number 1 selected")
        ElseIf Request.QueryString("q") = "me1" Then
            Response.Write("Number 2 selected")
        ElseIf Request.QueryString("q") = "m2" Then
            Response.Write("Number 3 selected")
        Else
            Response.Write("Nothing selected")
        End If

On the page that this will be displayed i have

<script type="text/javascript">
function showCustomer(str)
{
var xmlhttp;    
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
   
    }
  }
xmlhttp.open("get","menu.aspx?q="+str,true);
    xmlhttp.send();
//
}
</script>

Within the boty i have

<div id="txtHint">Customer info will be listed here...</div>
                <a href="javascript:showCustomer('me')"> 1</a>

However it still does not go of and bring the data back.

Please can anyone help me.

Baker
0
 
LVL 1

Author Comment

by:Bakersville
ID: 34918211
Thank you all, but i now have it working and bring the information accross.

Basically, the above worked, but i was trying to bring accross an entire page and not just the code itself.

Baker
0
 
LVL 1

Author Closing Comment

by:Bakersville
ID: 34918227
Thanks for pointing me in the right direction
0

Featured Post

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.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
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