I think I'm doing this right, but... not working.
I have a master page, and the master includes an ascx control. In this ascx control, I have the following code:
<asp:UpdatePanel ID="uplTimeout" runat="server"> <ContentTemplate> <ig:WebDialogWindow ID="wdwTimeout" runat="server" Height="300px" Width="400px" InitialLocation="Centered" WindowState="Hidden"> <ContentPane> <Template> <script type="text/javascript"> function setDialogTimer() { var t = setTimeout('showDialog', 5000); } function showDialog() { var dialog = $find('<%= wdwTimeout.ClientId %>'); dialog.show(); } setDialogTimer(); var dialog = $find('<%= wdwTimeout.ClientId %>'); dialog.show(); </script> Click to extend session.<br /> <asp:Button ID="btnExtend" runat="server" Text="Yes" /> </Template> </ContentPane> </ig:WebDialogWindow> </ContentTemplate></asp:UpdatePanel>
The code above does not represent what I'm actually trying to do, but what I'm trying to do now to see if I can get it to work, in practice, the last two lines would be gone from the script. However, that is where I get an error that it is not finding the WebDialogWindow
Hi,
I'm not really sure what you are trying to do. But I will suggest the following:
1. Move script block outside the control
2.Change dialog var to
var
dialog = $find("wdwTimeout");
if you use master pages the ID of the control will be changed, so you won't be able to find it. There is two solutions to that problem.
a) To debug your site/Application and see using FireBug or IEDevelopers, to see the ID (usually is changed to ctl100_something_ID of the control) - then copy and paste it to find above.
b) If you use CLR4 there is Property of the control named: ClientIdMode. If you set:
ClientIDMode
="Static"
That will not change the ID no matter you use Content Place Holders.
Hope that helped
All I am trying to do at this point is change the windowstate of the webdialogwindow via javascript. The only piece of code I'm currently concerned with is the last bit:
var dialog = $find('<%= wdwTimeout.ClientId %>');dialog.show();
I have put the script and web dialog onto the master page itself as well, with the same result, and I have tried (originally) to use $find("wdwTimeout"); which does not work because the client ID is necessary when using the master page. I have confirmed that the control name that the script uses is the same as the control name on the page. I am not using CLR4, but 3.5.
I had seen this article, but since it is for 9.2, maybe the method has since changed?
I believe you are trying to popup that window. Move the java script out of the window definition and then your function should call dialog.set_windowState($IG.DialogWindowState.Normal) to reset the status from Hidden to visible.
function showDialog() { var dialog = $find('<%= wdwTimeout.ClientId %>'); dialog.set_windowState($IG.DialogWindowState.Normal); }
Yes, I am trying to popup that window... but that I've never made it far enough to make it fail. The script is outside of the window definition, and outside of that updatepanel...
it fails before I get to the part where I can set the windowstate... the problem is that it can't find the Icontrol with var dialog = $find('<% wdwTimeout.ClientId %>');
You will see in my actual code that the = sign is there... and capitalizing the D doesn't fix it.
If I view source, I can see that the line has the correct id for the control:
The WebDialogWindow renders as:
<div class="ig_Control igdw_Control :=CtlMain:layout" id="ctl00_PageHeader1_wdwTimeout" style="height:300px;width:400px;visibility:hidden;overflow:hidden;position:absolute;display:none;">
etc.
</div>
and the script reads:
var dialog = $find('ctl00_PageHeader1_wdwTimeout');
= sign is missing in fron of wdwTimeout.ClientId and is ClientID not ClientId
var dialog = $find('<% =wdwTimeout.ClientID %>');