Why the breakpoint is not hitting in client side in visual studio? - asp.net

I am using visual studio 2008 and try to debug my code using Google Chrome.
When I setup breakpoints in .aspx.cs file then it is working correctly but in .aspx file it is not hitting.
Why?

It is working only on IE
<script type="text/javascript">
debugger;
your function()
{
}
</script>
but in Other browser you have to use Inspect Element by clicking F12 button ->source->page
I hope this will help u !!!!

Related

How to use jquery Backstretch in asp.net mvc

How to use backstretch in asp.net MVC. I included script files in my view page after when I run my program the image is not shown in the browser.
Here is the code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="~/Scripts/jquery.backstretch.min.js"></script>
<script>
$.backstretch([ "Images/img1.jpg",
"Images/img2.jpg],
{
fade:750,
duration:10000
});
</script>
It is just syntax error. You don't have a closing quotation mark for img2.jpg.
It should be
$.backstretch([ "Images/img1.jpg",
"Images/img2.jpg"],
{
fade:750,
duration:10000
});
Make use of developer tools in a browser (example: In Google Chrome F12 will take you to dev tools) to identify javascript errors. Switch to console tab to see the errors. and you can click on the link on the right hand side to locate the error.

Internet Explorer 11 gives script error in PageRequestManager.js

I'm using ASP.NET 4.5 on the server and I have a .NET Windows application with a Web Browser control that navigates to the web page on the server.
If I run the Windows application on a system with Internet Explorer 11, I get a script error: "Object doesn't support property or method 'attachEvent'" when navigating to another page. The script file is ScriptResource.axd so it isn't any of my scripts.
I do know that Internet Explorer 11 doesn't support attachEvent anymore (replaced with attachEventListener?). That is however not of much help here, as the javascript is part of the framework, not in my code.
I found the javascript source for the framework here:
http://ajaxcontroltoolkit.codeplex.com/SourceControl/latest#Client/MicrosoftAjax/Extensions/Sys/WebForms/PageRequestManager.js
// DevDiv Bugs 100201: IE does not set referrer header on redirect if you set window.location, inject anchor node instead
// dynamic anchor technique only works on IE
if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
var anchor = document.createElement("a");
anchor.style.display = 'none';
// cancel bubble so body.onclick is not raised
anchor.attachEvent("onclick", cancelBubble);
// more code...
}
This is the Sys.Webforms.PageRequestManager module that is part of the core ASP.NET framework as far as I understand.
The line that performs attachEvent gives script error on Internet Explorer 11, but works great on older versions of Internet Explorer.
How to fix this problem? Are there any known workarounds? I couldn't fine any updates for this.
Try forcing the browser to render in IE 10 mode...
<meta http-equiv="X-UA-Compatible" content="IE=10" />
I got that problem with jQuery 1.10 and it seems, that IE11 lacks the support of "attachEvent" which is used in jQuery and which seemed to be used by your framework as well. There is a Microsoft bugticket for that: Bugticket attachEvent IE11
I've found a solution in the related jQuery bugticket. Just insert the following code before your framework:
var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/));
if (isIE11) {
if (typeof window.attachEvent == "undefined" || !window.attachEvent) {
window.attachEvent = window.addEventListener;
}
}
You first check if the browser is IE11 and then bind the attachEvent listener again so the error doesn't occur again.

Devexpress errors in IE

I have a complete ASP.NET that makes heavy usage of your DevExpress ASPx suite of controls. Grids, text boxes, round panels etc.
THe site works flawlessly in Chrome, Firefox however in IE some UI does not function. Example, i have an ASPxComboBox control. In IE it doesn't "Drop down".
Using F12 developer tools on the console line the following shows as the error code when the dropdown should fire
SCRIPT87: Invalid argument.
DXR.axd?r=1_42-DSzC3, line 1268 character
The function is below, line 1268 is line 5 in the code below
function _aspxCreateStyleSheetInDocument(doc) {
if(__aspxIE)
return doc.createStyleSheet();
else {
var styleSheet = doc.createElement("STYLE");
_aspxGetChildByTagName(doc, "HEAD", 0).appendChild(styleSheet);
return styleSheet.sheet;
}
}
Any suggestions where to start ?
Is resource merging enabled in web.config?
<devExpress>
...
<compression enableHtmlCompression="false" enableCallbackCompression="true"
enableResourceCompression="true" enableResourceMerging="true" />
...
</devExpress>
This issue is a specific of the IE browser (it can be encountered when too many stylesheet links are registered within a page). To resolve this issue, it is recommended that you enable “Resource Merging” http://help.devexpress.com/#AspNet/CustomDocument6911 option.
If AutoFormats/Themes are used, deploy controls skin via the «ASPxThemeDeployer” http://help.devexpress.com/#AspNet/CustomDocument7485 tool in the “Only skin files” mode.
See Also:
http://www.devexpress.com/kb=K18487

Focus is not coming in javascript

I have a button in aspx. In its onclientclick I called a javascript function which is written in JScript.js.
Following is my javascript:
function ChangeBG()
{
alert("hi");
}
I called this above function in button click. I had put breakpoint in javascript. But onclicking on button, alert is coming, but control is not going to breakpoint. What may be the reason for this? I am running in Internet browser. What change i can make to bring the focus to breakpoint. Can anybody help?
Before alert("hi"); put the stmt debugger;
ChangeBG()
{
debugger;
alert("hi");
}
Your control will come to debug when you are in debug mode. This problem occurs when javascript is in a separate js file.
Also do this to enable debugging in your IE browser
Go to
Tool-->Internet Options-->Advanced
Uncheck - Disable script debugging ( Internet Explorer )

Javascript Pop-Up WIndow Open Function

I am using the following JS function to open a pop-up window to display another website:
<script language="javascript" type="text/javascript">
function link()
{
window.open("www.google.com")
}
onClick="Link()"
The URL in the above example is just for testing. I actually intend on replacing the URL with a text value from a listbox, which is in the form of a URL. Anyway, when ever I start the debugger in Visual Studio, and execute the onClick, the pop-up window opens and gives me a page stating that there is a server error. Specifically, Server error in '/' application... resource cannot be found. Also, I notice that my URL is placed as follows: http://localhost:49456/www.google.com. I thought this function would give me a pop-up window with Google as the website. Is this a Visual Studio debugger issue, is my code wrong, or am I using the code in the wrong context? Any suggestions would be greatly appreciated.
you need to specify http:// in the url eg
window.open("http://google.com");
without that protocol specified, the browser will think the URL is relative to the current document.
Add http:// to your domain, i.e. http://www.google.com.

Resources