auto generated javascript function __doPostBack(eventTarget, eventArgument) - edit the function name

T

TJ

Is it possible to edit the auto generated javascript function names? I'm
working in a Plumtree portal and I have two portlets on the same page using
a datagrid control. The paging links from the first grid are causing
postback for the second grid that's further down the page. Long story
short, whichever grid is rendered last on a page is the one that responds to
grid postback events such as paging or column sorting.

Is there a way I can edit the javascript _doPostBack function name so I can
give each datagrid their own unique functions to call?
 
W

Walter Wang [MSFT]

Hi,

Thank you for your post.

Based on my understanding, the question is: you're using two portlets on
the same page which both contains a datagrid control, and when you clicking
on a link in the first grid, the event is actually handled by the second
grid. If I've misunderstood anything, please feel free to post here.

First I don't think it's likely caused by the javascript function name,
it's the control id argument in the function call that determines which
control's event gets fired.

And if the portlet control implements INamingContainer interface (it should
if it currently doesn't), it will create a new ID namespace within a Page
object's control hierarchy.

For example, we can create a UserControl which contains a DataGrid control
named "grid1", and then we add 2 instances of this UserControl on a page,
the postback link would be:

javascript:__doPostBack('WebUserControl1$grid1$ctl02$ctl01','')

It's because UserControl implemented INamingContainer interface which will
guarantee that its internal controls will have unique id in the Page
control hierarchy.


Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

TJ

You grasped the situation perfectly, and I agree w/ you that it should work
based on unique id's per grid. But alas that's how I have it configured and
yet it's still funky. Unfortunately, the Plumtree Portal (4.5WS - barely
equipped to handle .net portlets) just blasts out each web app (portlet) in
its entirety and doesn't handle much else for you. So each portlet has it's
own <form></form> tags on it and things can get weird if web apps are
sharing similar .net auto generated javascript - i.e. Plumtree really needs
uniquely named javascript functions or possible clashes can occur. But I
digress, I think your explanation should prevail, yet it doesn't. I have
one grid named DataGrid1 and another named RadGrid1. Even the two
javascript functions showing up in the same page should be able to handle
this...it doesn't. : ( Here is the relevant text from a basic 'view
source' of the page.

<script language="javascript" type="text/javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
theform = document.Form1;
}
else {
theform = document.forms["Form1"];
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
<form name="Form1">
<table id="DataGrid1">
<tr>
<td><span>1</span>&nbsp;<a
href="javascript:__doPostBack('DataGrid1$_ctl14$_ctl1','')">2</a></td>
</tr>
</table>
</form>

<script language="javascript" type="text/javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
theform = document.Form2;
}
else {
theform = document.forms["Form2"];
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
<form name="Form2">
<div id="RadGrid1">
<table cellspacing="0" border="0" id="RadGrid1__ctl1">
<thead>
<tr>
<th class="GridHeader"><span title="Click here to sort"
onclick="javascript:__doPostBack('RadGrid1$_ctl1$_ctl2$_ctl0$_ctl0','')">Client
Name</span>
</th>
</tr>
</thead>
</table>
</div>
</form>
 
W

Walter Wang [MSFT]

Hi,

Thank you for your update.

Now I get the whole picture of the problem. I don't think this is supported
in ASP.NET.

As a side note, is it possible to use some static html pages which
basically wraps the aspx page in iframe, then use those html pages as
portlet?


Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

TJ

hehe..fascinating idea w/ the iframe, that might have to be the solution.
Thx for your patience and your fast responses.
 
W

Walter Wang [MSFT]

Hi,

Thank you for your update.

Please let me know whether or not the suggestion works.

Have a nice day!


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top