Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading different HTML code into one single page on different link clicks
    primarykey
    data
    text
    <p>So, my boss has this crazy idea - the whole website working on one single page. So far - still ok, but here's the thing: - the different pages have different <code>div</code>s with content (like usual), and when some div is clicked (or link in it) some of the divs expand/collapse, working in the way of revealing different content. That's fine, but...</p> <ul> <li><p>he doesn't want to use JavaScript or anything for dynamic view of the website ('cuz I am leaving in 2 weeks and him and the other employee are not capable of JS, thus cannot improve/maintain if needed)</p></li> <li><p>his idea is to have the HTML code, for all the pages variations of the website, stored in the database, and upon clicking some link - reloading the page with the certain HTML. So not different <code>.html</code> files for every page, but only one for all of them.</p></li> </ul> <p>The problem is that it works for the first page that I load, initially, but then when I call another page, it gets twisted, since I call the function, that retrieves the HTML, but the other call of the previously loaded page is still there, so it calls again. Here's sample, so you understand: </p> <pre><code>&lt;script runat="server" type="text/C#"&gt; public string getPage(string name) { string page = "null"; switch (name) { case "media": page = getMediaPage(); &lt;!-- just function from the code-behind that retrieves the html code from the DB and passes it to the page --&gt; break; case "home": page = getHomePage(); &lt;!-- just function from the code-behind that retrieves the html code from the DB and passes it to the page --&gt; break; } return page; } &lt;/script&gt; &lt;/head&gt; &lt;body onload="addEvents();"&gt; &lt;form id="form1" runat="server"&gt; &lt;div id="parent"&gt; &lt;div id="presentation"&gt; SomeCompany ApS&amp;nbsp;&amp;nbsp;&amp;nbsp;Street3&amp;nbsp;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&amp;nbsp;CITY&amp;nbsp;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&amp;nbsp;INFO@Comapny.com&amp;nbsp;&amp;nbsp;&amp;nbsp;TLF: 999999 &lt;/div&gt; &lt;%=getPage("home") %&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>So that's how the initial page will be and then just in the <code>parent</code> div I will call the HTML for the other pages. One example of HTML, stored in the DB:</p> <pre><code>&lt;div id="mainmenu"&gt; &lt;b&gt;HOME&lt;/b&gt; &lt;br /&gt; PRODUCTS &lt;br /&gt; &lt;a href="&lt;%=getPage("media")%&gt;"&gt;SUPPORT&lt;/a&gt; &lt;br /&gt; CONTACT &lt;br /&gt; ABOUT &lt;br /&gt; &lt;/div&gt; &lt;div id="logo"&gt; &lt;/div&gt; </code></pre> <p>So I call this chunk of code slam it in the page. The twist happens as I have <code>&lt;a href="&lt;%=getPage("media")%&gt;"&gt;</code> clicked, so it loads the page normally, but there is <code>&lt;%=getPage("home") %&gt;</code> standing statically in the page, ALL THE TIME, as I need to start from somewhere, and it attempts to load the previous page again, and... server error.</p> <p>I know it's kinda stupid idea, but I can't argue with him anymore. </p> <p>So my question is - is there way of handling all this with some kind of <code>OnClick(Event e)</code> or some other way out, with calling different functions (as I already started). Or I should just tell the boss that it's not gonna work this way... </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload