We have an old ASP.NET WebForms site that currently only runs in Microsoft Edge because of the way hundreds of links open in popup windows. It needs to be rewritten, but that is our long-term project that has not been approved resources yet.
I recently learned how to use a timer to update Page 1 when dialog on Page 2 calls a 3rd dialog on Page 3. Page 3 sets a Session variable, and Page 1 listens for it.
This is my Page 1:
<form id="Form1" method="post" runat="server">
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function () {
setTimeout(function () {
var csrWhere = '<%=Session("csrWhere")%>'
if (csrWhere != '') {
alert(csrWhere);
location.reload();
}
}, 200);
});
</script>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<telerik:RadMenu ID="mnuMain" EnableEmbeddedSkins="false" CssClass="RadMenu_Claim" EnableShadows="true" OnClientItemClicking="MenuOpenWindow" CollapseAnimation-Type="None" DataSourceID="SiteMapDataSource1" Style="z-index: 999; position: absolute; top: 3px; left: 12px" runat="server" />
<asp:SiteMapDataSource ID="SiteMapDataSource1" ShowStartingNode="False" SiteMapProvider="XmlSiteMapProviderHome" runat="server" />
It is not firing, so I tried to pull up the Developer Tools and query some information using the Javascript console. That was when I noticed that Developer Tools will open, but the content of the page is blank:
By contrast, I can come here on the same PC running the same browser, and Developer Tools works like it should.
Obviously, something on the site is interfering with Developer Tools. We have 2 developers at our company, and neither of us have ever seen this or know what is causing it.
This website project has numerous older third party DLLs like Telerik and an older Javascript library, and I suspect it is one of those.
Does anyone know how I would find out what is blocking my Developer Tools?
2
Answers
As a general rule, when using a update panel, you have to open the developer tools (f12) in the browser BEFORE the page loads!
If not, and you jump to some page, then open developer tools, and hit refresh on the browser, and THEN click on buttons etc.
Apparently not!
Really, I don’t suggest such a hack design be attempted at all. What happens if the user opens up more then one tab? Really, but really really, this is not going to produce a stable nor robust enviorment.
Since popup blockers are LONG gone from the web land, then I suggest you simply replace the popups with a NICE popup utility. I at one time used the AjaxToolKit dialog, but far better is to build a REALLY nice dialog control (ascx). That way, for any page, you can simple drag + drop in this dialog control, and you are off to the races.
As for what (of many choices) dialog popup to use? Well, there is the bootstrap ones, but they are kind of jinkey in terms of how they are launched. Best choice is thus to adopt the jQuery.UI one, and it REALLY works nice.
How do these dialog utilities get past the popup blocker? Why of course they "fake" the popup, and use a div that is created, and with css, they look like a popup, behave like a popup, but are standard HTML markup, and thus no popup block will care, touch, or prevent as such, since then the browser would have to stop working and stop allowing standard HTML markup to work!!
So, say we have say some delete button, (server side code), and we want to popup a prompt to confirm the button click. So, if user hits no, then we do nothing, but if user hits yes, then we want the given button code to run.
So, say this markup:
And code behind is thus this:
Hence, the result is if user hits "delete", then code behind runs. If user hits cancel, then the server side code does not run.
So, the above gives a nice dialog, and also gives a nice (easy) way to conditional run a button click.
And the above jQuery.UI dialog also works well for display of any "div" content.
So say for editing, then we can use the dialog like this:
So, in place of attempting to use some loop with session() (which is going to be difficult at best), I suggest you replace the window() pops with a jQuery.UI dialog control. Obviously you want to build a nice re-useable library for this purpose, and have some kind of "my pop" routine that you can call with some parameters. Either way, adopting some kind of dialog system for your code will not only allow far easier refactoring by replacing the window() popup with a call to some JavaScript library, but you dialog code can follow a rather "similar" design pattern to what you have now. This would be far better then attempting to poll some other page via session().
Actually not. Have you noticed the little IE icon in the left of your address bar:
It means you are running this page in Internet Explorer mode. The Chromium DevTools apparently won’t work in IE mode.
To debug the content of an IE mode tab, use IEChooser to open Internet Explorer DevTools, as follows:
In Windows, open the Run dialog. For example, press Windows logo key + R.
Enter %systemroot%system32f12IEChooser.exe, and then click OK.
In IEChooser, select the entry for the IE mode tab.
Of course, you may wonder why you’re in IE mode. Normally, it is configured by your company (using group policies and such) for legacy application compatibility. In case you don’t want to run this application in IE mode, you can contact your administrator for more information.