I have an HTML file inside
<body /> tag with structure:
<div id='header'>content of header</div> <div id='content'>content of content.</div> <div id='footer'>content of footer</div>
El contenido de
footer are changed as per user interaction.
User selects content for
header section, The
header section adds the user content to the header
For this I made three stringbuilder variables respective to the three
<div />s in c#, whenever there is a change in any
<div /> the respective string builder variable updates and I am making an HTML temp file with
<head /> sección y una
<body /> section—and finally appending all the string builders to the
<body /> tag and saving the file. And if user wants to download the file, the file should have all the updates.
How to update the particular
<div /> content from code behind with c# with out making temp file?
I need changes directly on the file and I don't want to redesign the temp page in code behind.
preguntado el 10 de marzo de 12 a las 01:03
using update panel can resolve your issue.
just update the div in your codebehind.
You can use the following code for changing the content of specific Div. Try the following code in your code behind file
For Header header.InnerText = "Changed content of header";
same for other divs.
You could use jQuery (see: jQuery.com) for the async call (e.g. with $.getJSON or $.ajax) and modify the contents of the div with jQuery to like: $("#header").html(yourResult).
The call to the server could be handled by a handler (.ashx) or WCF service or whatever works for you.
Hope this gets you further!