Solved

Display criteria change without refreshing whole page in asp.net

Posted on 2011-02-15
10
499 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:gurvinder372
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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
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 250 total points
ID: 34896451
0
 
LVL 14

Assisted Solution

by:Dhanasekaran Sengodan
Dhanasekaran Sengodan earned 250 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

691 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