I am facing this issue in my asp.net application when using update panel. The error only with IE9 and for other browser application works fine. For debuging purpose and to conclude the issue only when using update panel I created a sample asp.net web site.
ASPX
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager runat="server" />
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="Button1" Text="Click Me" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
When I click on the button, I get the following JS error.
The JS error is
From IE's F12 developer tool,
SCRIPT5007: Unable to get value of the property 'tagName': object is null or undefined
frameTracker.js, line 2 character 395
From Visual Studio 2012,
But when I remove the update panel, the JS error is no longer.
Any idea to solve this problem?
Add following line in <head>
<meta http-equiv="X-UA-Compatible" content="IE=8;FF=3;OtherUA=4" />
OR
<meta http-equiv="X-UA-Compatible" content="IE=9;FF=3;OtherUA=4" />
OR
<meta http-equiv="X-UA-Compatible" content="IE=Edge" /> // is will always be rendered in IE's latest and greatest mode
Related
I'm trying to add a report to my project in MVC Asp.net, (Visual Studio 2017). the problem after adding (after many tries)the package and when I wanted to add the report to my format I got this error: the server tag 'rsweb:ReportViewer' is ambiguous.modify the associated registration that causes ambiguity and choose a new tag prefix
this is my code in .aspx page:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server"></rsweb:ReportViewer>
</div>
</form>
</body>
</html>
thanks for help.
This is what I have when I want to add other items in Tools Box:
enter image description here
I have googled and have search this forum, i can not find solution to my problem. As stated by the title in my webforms project using vs 2015 both these mentioned controls are causing a full page post back after uploading is done. In my other projects this works fine. But in this particular one i cant figure it out. Is there just a common thing I am over looking, I have created fresh pages with out using the master-page I still get the same results - full post back. I did not post my code because i am using the controls as any other programmer would.
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="pic1.aspx.cs"
Inherits="SSWebAppV1._1.pic1" %>
<%# Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
Width="500px" AllowedFileTypes="jpg,jpeg,png" MaximumNumberOfFiles="4"
OnUploadComplete="AjaxFileUpload1_UploadComplete" />
</div>
</form>
</body>
</html>
****code-behind***
protected void AjaxFileUpload1_UploadComplete(object sender,
AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
string fileName = Path.GetFileName(e.FileName);
AjaxFileUpload1.SaveAs(Server.MapPath("~/Eimages/" + fileName));
}
I've downloaded DropDownCheckBoxList control from it's official page.
I've created new WebSite inside Visual Studio 2012 using File -> New -> WebSite and I added dll into references.
Then inside Default.aspx I've added this sample code:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%# Register TagPrefix="asp" Namespace="Saplin.Controls" Assembly="DropDownCheckBoxes" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownCheckBoxes ID="checkBoxes2" runat="server">
<Style SelectBoxWidth="300" />
<Items>
<asp:ListItem Text="Option 1" Value="1" />
<asp:ListItem Text="Option 2" Value="2" />
</Items>
</asp:DropDownCheckBoxes>
</div>
</form>
</body>
</html>
After starting debugger my web site is displayed, but when using element inspector in Chrome I noticed that DropDownCheckBoxes isn't rendering value field for checkboxes:
Inside download package that comes with DropDownCheckBoxList is sample project, when I start it I can see that value field is rendered:
It's my fourth hour trying to figure out what is wrong with my code!
How should I create WebSite or WebApplication to have value field rendered?
After another 4 hour searching over SO I found awesome answer:
https://stackoverflow.com/a/15030781/965722
When below entry is added into web.config value isn't rendered
<pages controlRenderingCompatibilityVersion="3.5">
So removing it instantly solved my problems.
I have an ASP.NET page with a Submit button. When I click the button my code runs and then the page reload/refresh....the whole page gets posted back.
What must I use or do to prevent the page from reload? AJAX? How would this be done?
Code examples would be great!
Check the below code with AJAX and Without AJAX
Case 1 With AJAX
In this we added following controls
1. Script Manager
2. Ajax Update Panel with Trigger and Content Template
3. Button
In this case, you will notice that on clicking the button, the controls which are outside the Update Panel will not be updated. That means controls inside the Update Panel will be updated on clicking the button. That means complete page will not be refreshed. I hope this fulfill your requirement....
Output
Date outside the update panel will not be updated and date inside the update panel will only be updated because it is inside the update panel so complete page will not be refreshed.
Source Code
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%=DateTime.Now %>
<br />
<asp:ScriptManager ID="scr" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="Upd" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%=DateTime.Now %>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="btn" runat="server" Text="Click Me" />
</div>
</form>
</body>
</html>
Case 2 Without AJAX
The below case will also update the date but this time page will be refreshed completely due to absence of Update Panel
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%=DateTime.Now %>
<asp:Button ID="btn" runat="server" Text="Click Me" />
</div>
</form>
</body>
</html>
Hope this article will help you understand the quick basics
If you don't want the page to reload, you should take a look at the UpdatePanel Control: http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx
If you want to avoid that your code is run again
you can do in your page_load event
If(!page.IsPostBack())
{
your code here
}
and ajax to avoid reload in jquery
with the example here
or with asp ajax panel
Someone can explain this error?
Error Creating Control - head
Object reference not set to an instance of an object.
<%# Page Title="" Language="C#" MasterPageFile="~/Controls/Master1.Master"
AutoEventWireup="true" CodeBehind="GrupoUsuario.aspx.cs" Inherits="GrupoUsuario" %>
<asp:Content ID="Content1" runat="server" contentplaceholderid="head">
</asp:Content>
I Think this is a bug of visual studio 2010 in design view. I'not using any event to manipulate session object in the method OnInt(). The "PlaceHolderTopo" is an placeholder in the web user control Topo.ascx. It's work normaly. I Don't have any code inside the content place holder in the page tha inherits from the master page and get this error.
Below is the code of the masterpage:
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="PrincipalSeguranca.Master.cs" Inherits="PrincipalSeguranca" %>
<%# Register Src="Topo.ascx" TagName="Topo" TagPrefix="uc1" %>
<%# Register src="MenuAdmin.ascx" TagName="MenuAdmin" TagPrefix="uc2" %>
<%# Register src="Rodape.ascx" tagname="Rodape" tagprefix="uc3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Sistema</title>
<script language="jscript" type="text/javascript" src="Scripts/Geral.js"></script>
<link rel="shortcut icon" href="../layout/ico/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../layout/css/styles.css" type="text/css" />
<link href="../layout/css/menu_tabbed.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../layout/css/contents.css" type="text/css" />
</head>
<body>
<form id="form1" ClientInstanceName="form1" runat="server">
<uc1:Topo ID="Topo1" runat="server" />
<div id="corpo">
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="rodape">
<uc3:Rodape ID="Rodape1" runat="server" />
</div>
</form>
</body>
</html>
You have a bug in your Rodape control at design time.
When you open your page in Design view, it creates an instance of your custom control in Visual Studio's process. Since your website is not actually running, the code in your control is probably accessing some static member which hasn't been initialized.
You should launch a second copy of Visual Studio, attach its debugger to the first copy, set Break on All Exceptions from the Debug menu, and find your bug.