M
Mike Dunn
I would like to change the name of the _doPostBack
function emmitted by the ASP.NET framework to prefix it
with an ordinal number i.e. the page should show
<script language="javascript">
<!--
function _369__doPostBack(eventTarget,
eventArgument) {
var theform =
document.frmRetailTenantGadget;
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value =
eventArgument;
theform.submit();
}
// -->
</script>
The reason for this is I am working on a portal server and
the output form multiple aspx pages ends up in the same
HTML page. Multiple declarations of __doPostBack cause a
problem in the page. I have found one way to do this is to
override the page render event thus
protected override void Render
(HtmlTextWriter writer)
{
StringBuilder stringBuilder = new
StringBuilder();
StringWriter stringWriter = new
StringWriter(stringBuilder);
HtmlTextWriter htmlWriter = new
HtmlTextWriter(stringWriter);
base.Render(htmlWriter);
string html =
stringBuilder.ToString();
// Prepend postback scripts with
gadget ids
html = html.Replace
("__doPostBack", "_" + GadgetId + "__doPostBack");
writer.Write(html);
}
This works but I believe it could cause a problem with
performance as the find replace is an expensive operation.
Does anyone know a better (faster? more elegant?) way of
doing this
Regards
Mike
function emmitted by the ASP.NET framework to prefix it
with an ordinal number i.e. the page should show
<script language="javascript">
<!--
function _369__doPostBack(eventTarget,
eventArgument) {
var theform =
document.frmRetailTenantGadget;
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value =
eventArgument;
theform.submit();
}
// -->
</script>
The reason for this is I am working on a portal server and
the output form multiple aspx pages ends up in the same
HTML page. Multiple declarations of __doPostBack cause a
problem in the page. I have found one way to do this is to
override the page render event thus
protected override void Render
(HtmlTextWriter writer)
{
StringBuilder stringBuilder = new
StringBuilder();
StringWriter stringWriter = new
StringWriter(stringBuilder);
HtmlTextWriter htmlWriter = new
HtmlTextWriter(stringWriter);
base.Render(htmlWriter);
string html =
stringBuilder.ToString();
// Prepend postback scripts with
gadget ids
html = html.Replace
("__doPostBack", "_" + GadgetId + "__doPostBack");
writer.Write(html);
}
This works but I believe it could cause a problem with
performance as the find replace is an expensive operation.
Does anyone know a better (faster? more elegant?) way of
doing this
Regards
Mike