Installed it like 1 hour ago, added some code and forms. Then wasted to test it out on browser with ctrl+F5 command and all I see is loading of the page.
http://pasteboard.co/1wumd89u.png
Reddit, what to do ._ .?
P.S: Tried to restart VS and change browsers. Did not helped.
I assume you are running the app via internal iis (casini). Using ctrl+F5 will run your app without any debugging support. Try using F5 only instead.
As christutty suggest put an early breakpoint. Select your Default.aspx file from the solution browser and hit F7, this will bring up the codebehind of your default page. You will see the page_load event, declare a variable like:
For C# string myString = "Hello World!;
For VB myString As String = "Hello World!"
On the left side of that line click untill you get a red dot. Red dots are break point, mean that the debugging will stop the page execution. After you hit F5 and get to that break point hit F10 for each subsequent line, hit F11 if you enter into an external method.
Related
I have an Ajax enabled website, with some calls to the Script Manager to set history points like so:
if (uxScriptManager.IsInAsyncPostBack)
{
uxScriptManager.AddHistoryPoint("x", taxid.ToString());
}
This works just fine 90% of the time.
However, about 10% of the time, the history points stop being set. This seems to happen when I've clicked around a bit and then start using the back button to go back pretty far (usually 6 or 7 steps in the history).
Has anyone else noticed/seen this behavior? The code I've got that picks up the state information from the history points to rebuild the page seems to work fine.It's just sometimes the script manager seems to forget to set the history point.
EDIT
I've noticed some strange behavior with the script manager - after the third or the fourth click back, is seems to break and the Ajax calls no longer work. The user needs to reload the page in order for the history to start working again. Anyone seen this type of behavior? (I'd think if I wasn't doing it right, it wouldn't work at all...)
I have a small requirement..
if the user dint sign off or log off then he try's to close the browser IE clicking on 'X' (top right of IE or Firefox browser ) then i need to ask a conformation message like "Are you sure you want to close ?" ...
I am using Master page in my application and i tried the event : "window.onbeforeunload " in my master page its works fine, shows an alert(conformation) message. but if i press back button on the browser(IE on IE or Firefox) then also its firing(but it should not) is there any way to full fill my requirement ..I hope i had explained u clearly...if not pl z let me know........
what i mean to say is.. if the Session("USerid") is active or if it contains any value ie.
Session("USerid")="XXX"
at that moment if user trys to close the browse(click in 'X'/Close button browser either IE or Firefox ) it should give prompt a message "are u sure do u want to close?"..
Its all about design steps - but the close and the back button is the same, the close the page, so maybe its impossible to have them all together.
To open, close your script you can make a simple trick. Place them inside a literal and open or close it.
<asp:literal run="server" id="txtCloseAlert">
<script>
... you code here ....
</script>
</asp:literal>
and on code behind.
txtCloseAlert.visible = !string.IsNullOrEmpty(Session("USerid"));
I've looked into this recently and there does not appear to be a standard / consistent way to do this cross-browser hence you back-button problem.
On IE at least you get an event object passed as a parameter to the onbeforeunload method that you can use to get the mouse position, but in FireFox you don't and you would need some other way to determine whether a confirmation is required. It is quite posible that you could get the mouse position in some other way as I haven't looked into that. Point is that if your mouse is not on your form you probably want a confirmation.
You can look at this SO question:
Prevent browser from closing in asp.net
Or do an Internet search on 'onbeforeunload prevent browser closing'.
In your case a synchronous ajax call can be made to the server to do the test.
HTH
I've made a HTA that just links to a website and once you're there you can navigate through several different pages. It's not an application that can change or access anything on the computer.
My problem is when I try to put a frame or an iframe in a page with an external website inside this frame, script errors keep popping up. When I view these same webpages on Internet Explorer 9, no errors show up.
Error Example:
http://i39.tinypic.com/keyfs4.gif
I know HTAs can access the files on a computer and have higher privileges and security over normal pages that are viewed in a browser. Is this the reason script errors show up when on a HTA?
Is there any way I can stop these errors coming up?
Your script has errors. You need to fix them.
The difference is, the Web Browsers a HTML with script errors are less likely to show all script errors. The usual symptom is your script does not run correctly but you're not given any indication as to why.
As a HTA, your same script errors will display as a dialog box. This will tell you why your scripts do not run correctly.
As a personal rule, I generally prefer to code first in HTA so that I can locate and fix errors before deploying them as HTML.
Take the following code example. As a HTA when you click on the Test button it will correctly show "Begin" then it will correctly report your script has a Division by Zero error. As a HTML, in Internet Explorer, the test button will just show "Begin" and then it will abort without giving you any indication why.
<html>
<head>
<title>test</title>
<script language="VBScript">
Sub btnTest_onClick
MsgBox "Begin"
MsgBox 100 / 0
MsgBox "End"
End Sub
</script>
</head>
<body>
Click on this button: <input type="button" id="btnTest" value="Test"/>
</body>
</html>
#BicycleDude - the errors are not located within #user990175's code but within the external website he is loading into an iframe. So he can't really control the errors that are thrown in 3rd party code.
#user990175 - the issue you're seeing is a result of the third party code using htc's which I'm 90% sure are not supported in hta's, or have special considerations anyway. Either way you should be able to disable error notifications via the error prompt itself or under Tools > Options > Advanced tab > Browsing section > Dispaly a notification about every script error.
That doesn't mean the functionality will magically work, it just means you won't be prompted with the pesky dialog box.
for reason I won't bore you with, I'm writing an asp.net application that must open some pages in new browser windows.
I managed to open them within a postback (don't ask why, I just needed to) with this code:
script = String.Format(#"window.open(""{0}"", ""{1}"");", url, target);
ScriptManager.RegisterStartupScript(page, typeof(Page), "Redirect", script, true);
Now I have new windows each one with a button that should close it. I have simply an onclick="window.close()" (but that prompts me when I'm closing the browser) or window.open('','_self','');window.close() (horrible, I agree but it's the only way I found to avoid the JS prompt)
On firefox it works perfectly but on IE7 (the browser our customers have) after 2-3 times I use that button to close the window I can't open other windows (in both cases, with or without the JS prompt). With the method above it does nothing, and with a click me a new window is opened but hangs on loading (it doesn't even calls the Page_Load).
What could be the cause? How can I solve this?
Thank you.
EDIT:
I forgot to mention that I'm using MS Ajax in most of the pages, and that may be the reason that forces me to use window.open('','_self',''); before window.close()
I don't know if this could cause also the hanging of IE
EDIT: Ignore that, it does still prompt the user - sorry!
For your first issue about closing the window, have you tried:
self.close();
Not too sure about the hanging issue though, I use window.open() and have never experienced issues in IE7.
I finally came to a solution:
on the attribute assignment there was a return false; missing.
Now it works perfectly with "window.open('','_self','');window.close();return false;".
I'm showing a modal dialog via "window.showModalDialog(..." which happens in a vbscript function (the page shown is aspx). I'd like to do some resizing of the window based on the number of rows in a datatable that's coming back. So naturally I go to register a startup script that resizes the window based on the number of rows. Well, that didn't work, so I tried to register a script that just showed a msgbox.
The code looks like (in the OnLoad event handler):
if (!this.ClientScript.IsStartupScriptRegistered(typeof(MyPageClassName), "hello"))
{
this.ClientScript.RegisterStartupScript(typeof(MyPageClassName), "hello",
#"<script language=vbscript>
sub fnWindowOnLoad()
MsgBox ""hello""
end sub
<script>", false);
}
if (!this.ClientScript.IsStartupScriptRegistered(typeof(MyPageClassName), "hello"))
{
throw new Exception("Failed to load script");
}
To me it looks like this should work and show a message box that says "hello" when the page loads (I've got the window's onload event set to fnWindowOnLoad). But what happens is nothing, no exception, no alert. I've tried every Type I could think of in the typeof call. Nothing seems to work. The only thing I can think of is that since the dialog is a modal ClientScript.RegisterStartupScript won't run properly. But that doesn't make any sense to me.
I put the MsgBox "hello" call into my script block directly and the alert showed, so it's possible. But I need to modify some arguments in the code behind so I have to use RegisterStartupScript as far as I can tell.
Have you tried opening your window via window.open() rather than window.showModalDialog()? I've seen some postings on the web about incompatibilities between showModalDialog() and RegisterStartupScript.
showModalDialog() is an IE only method, so it's not recommended anyway. I know it's convenient because it returns a value, but there are various ways to simulate this functionality.
Edit: The other problem with showModalDialog() is that IE often caches the results. This means that if one time you calling the dialog, you do not resize it, then another time you do, then 2nd time might get your the first cached dialog. A way to get around this is to add a unique querystring at the end. Like MyDialog.aspx?q=320934 (randomly generated or generated based on server tics).
The solution for this was to have a script that read a value out of a hidden field and then resized the dialog. The value was set on the Page_Load. Using RegisterStartupScript never seemed to work, neither did RegisterClientScript, so I'm pretty sure modal dialog and RegisterXxx don't get along. Need to use window.dialogHeight & window.dialogWidth in the vbscript.