Last post Dec 17, 2010 02:01 PM by ww1711
Dec 14, 2010 08:28 PM|ww1711|LINK
I'm looking for some help here...
Here's what I've got:
Everything works fine there...
What I'd ideally like to do is call a .net function called "generateTableHeader" I've got that returns a string containing the following (and then append the innerHTML after):
<tr align='center' style='height: 50px;'>
<div style="position:absolute; overflow:auto; height:430px;>"
My goal is to ultimately make something like this work:
= '<%=generateTableHeader() %>' + document.getElementById('details_Placeholder').innerHTML + '</div>';">
I've either got an issue with the way it's written, or it's just not possible...
Oh, by the way, the div's innerHTML contains <table>....</table>.
Dec 14, 2010 09:26 PM|grundebar|LINK
attribute values. You will need to escape out single quotes or quotes to avoid string termination problems. Simply add a \ prior to any quote or single quote to escape that character for js purposes. Try adding that to your function and let us know if you
run into more issues.
Dec 17, 2010 06:30 AM|Wenchao Zeng - MSFT|LINK
<body onload="page_load()" >
public string generateTableHeader()
// Use \" to input a quote.
// Don't use builder.AppendLine() method or input \n in the content.
System.Text.StringBuilder builder = new System.Text.StringBuilder();
builder.Append("<tr align=\"center\" style=\"height: 50px;\">");
builder.Append("<div style=\"position:absolute; overflow:auto; height:430px;\">");
var header = '<%= generateTableHeader() %>';
var content = document.getElementById("details_Placeholder").innerHTML;
document.getElementById("txtHtmlSrc").innerHTML = header + content + '</div>';
<div id="details_Placeholder">This <b>is</b> the content.</div>
<asp:Label ID="txtHtmlSrc" runat="server" Text="Label"></asp:Label>
Dec 17, 2010 01:28 PM|ww1711|LINK
Thanks for the input. I got the functionality working, but as we all know, there's always something!
My new issue:
The reason why I have the stringbuilder function to populate the table headers is because the original table headers are ASP:LinkButtons and I'd rather bring in static text rather than the LinkButtons. The LinkButtons call a function that re-orders the
datatable that feeds the Repeater (which is what's present in "details_placeholder"). Now when I click the buttons to resubmit the query and reorder the list (and refresh the page with the new query results), I'm getting this:
I've got the "debug = true" in the header and the compilation setting in the web.config file set correctly...
Dec 17, 2010 02:01 PM|ww1711|LINK
I remedied the issue by adding ValidateRequest="False" to the page directive.