Hi Peter,
Thanks for your code. It's a page life cycle issue. You're dynamically
creating controls in the ItemDataBound event handler so the click event of
the button will not fire on postback. To work it around please try
following steps:
1. Comment the following lines in the lstContent_ItemDataBound event
handler in the ViewRunningJobs.ascx.cs:
PopUpData pud
=(PopUpData)Page.LoadControl("~/DesktopModules/RunningJobs/PopUpData.ascx");
pud.RReport = (RunningReport)e.Item.DataItem;
phParameters.Controls.Add(pud);
phParameters.Visible = true;
2. Replace the DataList in ViewRunningJobs.ascx with following one:
<asp
ataList ID="lstContent" DataKeyField="ItemID" runat="server"
CellPadding="4"
OnItemDataBound="lstContent_ItemDataBound">
<ItemTemplate>
<table cellpadding="4" width="100%">
<tr>
<td valign="top" width="100%" align="left">
<asp:Image ID="imgJob" runat="server"
ImageUrl="" Height="36px" Width="42px" />
<asp:HyperLink ID="HyperLink1" NavigateUrl='<%#
EditUrl("ItemID",((int)DataBinder.Eval(Container.DataItem,"ItemID")).ToStrin
g()) %>'
Visible="<%# IsEditable %>" runat="server">
<asp:Image ID="Image1" runat="server"
ImageUrl="~/images/edit.gif" AlternateText="Edit"
Visible="<%# IsEditable%>"
resourcekey="Edit" />
</asp:HyperLink>
<asp:Label ID="lblContent" Font-Size="12pt"
ForeColor="Blue" runat="server" />
--> Start Time '<%#
DataBinder.Eval(Container.DataItem,"StartTime") %>' <span id="InstanceID"
style="display: none">Report ID '<%#
DataBinder.Eval(Container.DataItem, "InstanceID")%>'
</span>
<div>
<cc1:HoverMenuExtender
ID="HoverMenuExtender1" runat="server" TargetControlID="imgJob"
PopupControlID="pnlReportInfo"
PopupPosition="Right" PopDelay="25" OffsetY="-240" OffsetX="-30">
</cc1:HoverMenuExtender>
<asp
anel ID="pnlReportInfo" runat="server"
CssClass="balloonstyle">
<br />
<br />
<asp
laceHolder ID="phParameters"
runat="server">
<uc1
opUpData runat="server"
ID="PopUpData1" Visible="true" /></asp
laceHolder>
<DBWC
ynamicControlsPlaceholder
ID="phParameters1" runat="server">
</DBWC
ynamicControlsPlaceholder>
</asp
anel>
</div>
</td>
</tr>
</table>
</ItemTemplate>
</asp
ataList>
In this way we add the PopUpData control in aspx directly instead of
dynamically creating it in the code behind. The control will then be
populated on an earlier stage of the page life cycle that can make sure the
event will fire on the postback.
Please let me know if it works.
Regards,
Allen Chen
Microsoft Online Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Peter" <
[email protected]>
| References: <#
[email protected]>
<
[email protected]>
| Subject: Re: Execute JavaScript from server side
| Date: Thu, 13 Nov 2008 18:18:54 -0600
| Lines: 23
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| X-RFC2646: Format=Flowed; Response
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| Message-ID: <#
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: CPE-72-129-145-58.new.res.rr.com 72.129.145.58
| Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP05.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:79845
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| No, it does not matter if it's true or false
|
|
| | > | >
| >> //
| >> // the alert from the following line never shows up
| >> //
| >> ScriptManager.RegisterStartupScript(this, GetType(), "Refresh",
| >> "alert('test');", false);
| >
| > Does it work if you change the final argument from false to true...?
| >
| >
| > --
| > Mark Rae
| > ASP.NET MVP
| >
http://www.markrae.net
|
|
|