PROKA Posted February 19, 2008 Posted February 19, 2008 OK so have a default.aspx page. All I have in this page is a div <div id="test" runat="server"></div> doing some little magic in code behind I can insert html into that div. Ok. What I want to do is to insert a whole page.html there and after the page is inserted, work with the <div runat="server"> from the page.html let's say the page.html looks like this: <div id="id1" runat="server"></div> <div id="id2" runat="server"></div> first I want to replace the "test" div with the content from the page.html . then I want to use the id1 and id2 divs to work with .innerhtml = etc (I'm trying to do some kind of easy skinning system) HOW? Quote Development & Research Department @ Elven Soft
PROKA Posted February 25, 2008 Author Posted February 25, 2008 Any Ideea? PLS :( Quote Development & Research Department @ Elven Soft
Administrators PlausiblyDamp Posted February 25, 2008 Administrators Posted February 25, 2008 Could you not just use a literal control and set it's text to the html you want to display? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
PROKA Posted February 25, 2008 Author Posted February 25, 2008 Ok You didn't quite understood me. So I use a literal control to inject html, but also I want to modify that html according to the database. I want to be able to work with divName.InnerHtml = ... Quote Development & Research Department @ Elven Soft
Fork501 Posted February 26, 2008 Posted February 26, 2008 OK so have a default.aspx page. All I have in this page is a div <div id="test" runat="server"></div> doing some little magic in code behind I can insert html into that div. Ok. What I want to do is to insert a whole page.html there and after the page is inserted, work with the <div runat="server"> from the page.html let's say the page.html looks like this: <div id="id1" runat="server"></div> <div id="id2" runat="server"></div> first I want to replace the "test" div with the content from the page.html . then I want to use the id1 and id2 divs to work with .innerhtml = etc (I'm trying to do some kind of easy skinning system) HOW? I don't think this will be able to be accomplished with .NET code. In order to reference an object, it must first exist. You will just receive compile errors because of this. Think of it in the terms that if your page.html were to get erased, you would definitely not have those objects there, anymore. In order to do this, you will need JavaScript. var div1 = document.getElementById("id1"); var div2 = document.getElementById("id2"); In JavaScript, it has error detection and will just give you a page error if the document isn't there. I do this all the time for my AJAX pages; it's the only real solution that I know of. ~Derek Quote Check out my blog! DevPaper.NET
PROKA Posted February 26, 2008 Author Posted February 26, 2008 how does this help me? Quote Development & Research Department @ Elven Soft
Fork501 Posted February 26, 2008 Posted February 26, 2008 how does this help me? I apologize, I elaborated and never finished. To get page.html on the original div, you will need what is called the XMLHttpRequest object. It is used to go behind the scenes to grab content from pages. Here's an explanation and some exampleds: http://en.wikipedia.org/wiki/XMLHttpRequest Oh, and you won't make any of your divs with "runat=server". (Your probably know this already, but I wanted to make sure to throw it out there so I cover all of my angles.) Hope this helps! EDIT: I forgot to mention that if you don't want to go the complete route of JavaScript and are very adament about using .NET technology for this, Microsoft released all of those nifty little AJAX controls. I've never personally used them, but the head programmer at my job uses them all the time and he loves them. He doesn't understand why I like JavaScript so much. ~Derek Quote Check out my blog! DevPaper.NET
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.