?
Solved

assign div inner contents dynamically - from another web page (aspx)

Posted on 2009-04-16
8
Medium Priority
?
471 Views
Last Modified: 2012-06-27
<div id="divinnercontent" runat="server">

[[ content from an aspx page ]]

</div>



This part:   [[ content from an aspx page ]]

I want to change based upon a click on a hotspot in an image map.
0
Comment
Question by:Tom Knowlton
  • 5
  • 3
8 Comments
 
LVL 12

Expert Comment

by:wht1986
ID: 24161129
use XmlHttpRequest, an example can be found http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
0
 
LVL 12

Expert Comment

by:wht1986
ID: 24161188
just in case, whatever javascript function you create to initiate the XmlHttpRequest, your hotspots would call it via the onClick event of the tag

<area shape ="circle" coords ="90,58,3" onClick="GetDetails( 'mydetailurl1.html' );"  .....   />
<area shape ="circle" coords ="56,23,3" onClick="GetDetails( 'mydetailurl2.html' );"  .....   />
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 24161240
What if I wanted to do this in the code-behind?
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 5

Author Comment

by:Tom Knowlton
ID: 24161258
For example:

 protected void ImageMap1_Click(object sender, ImageMapEventArgs e)
    {
      if (e.PostBackValue.Contains("services"))
      {
        divinnercontent.InnerHtml = [[[ GET INNTER HTML FROM SERVICES.ASPX ]]]
           
      }
    }
0
 
LVL 12

Accepted Solution

by:
wht1986 earned 2000 total points
ID: 24161349
Ah, even easier.

1) if the file is on the same server, you could read the file into a string and set divinnercontent.innerHTML = "mystringhere";

2) If its on remote location, you can use the WebRequest object to read in the remote page into a string
http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx

3) Place an IFrame in the div and set the href location of the iframe to be your desired page
0
 
LVL 12

Expert Comment

by:wht1986
ID: 24161402
if you need only a particular div out of 'remote' page, you can use some XML goodness.

string pageHtml = "what ever the full html from the page is"

XmlDocument doc = new XmlDocument();
doc.LoadXml(pageHtml);

then you can use some methods to find the div.  If the remote div of interest is called 'woohoo1' then

XmlElement elem = doc.GetElementById("woohoo1");

divinnercontent.innerHTML = elem.innerHTML;
0
 
LVL 12

Expert Comment

by:wht1986
ID: 24164690
Any of those suggestions help?
0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 31571121
The iframe suggestion worked. Now my problem is with formatting, but that will be a new question.  :)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

864 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