error while creating the control- rsweb-Reportviewer in VS2017 - c#

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

Related

Register alternative tagprefix for standard controls

I want to create a tag prefix for controls in System.Web assembly.
<%# Page Language="C#" CodeBehind="SimpleCustomControl.aspx.cs" Inherits="SimpleCustomControl" %>
<%# Register TagPrefix="CC" Namespace="System.Web.UI.WebControls" Assembly="System.Web" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<CC:TextBox runat="server"></CC:TextBox>
</div>
</form>
</body>
</html>
But getting "Unrecognized tag prefix or device filter CC. Can not resolve symbol CC" error in VS. And no autocomplete is available after entering <CC:.
Is it possible to register such kind of tag prefix for standard controls?

Update panel causes JavaScript error

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

Display simple c# in "sharepoint online"

I am using "SharePoint Online" and I'm new to it. I have descend programming background and I need more Info on customisation of this service. I've never worked with .NET before (WHAT?!), but I would really like to learn more about C# and it's use in the industry. I have full access to SharePoint Designer and I have Visual Studio 2008.
1) How can I implement simple c# code on SharePoint web page?
2) How to import and use c# classes on SharePoint page?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%# Page Language="C#" %>
<%# Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 4</title>
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<SharePoint:CssRegistration Name="default" runat="server"/>
</head>
<body>
<form id="form1" runat="server">
</form>
</body>
</html>
This is a brand new, empty .ASPX page generated by "SharePoint Designer". How can I import and display simple "Hello World", c# code on it?
Thank you very much in advance
Inside your <form> tag, insert this line:
<form id="form1" runat="server">
<% Response.Write("Hello World"); %>
</form>
Have fun learning C#
You cannot run server-side scripts on your ASP.NET pages in SharePoint online. It is not allowed and will tell you as much when you try to do this.
If you had an on-premises site, you could modify a setting in web.config to enable this, but that is beside the point.

Form in C#/Sharepoint

I am trying to create a form in Sharepoint using C#. I don't know C# that well and that is where my error is occurring. I want the information to be emailed to the address on submission. Here is the code I have for my tizagEmailForm.html...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 2</title>
</head>
<body>
<form method="POST" action="tizagEmail.aspx">
To <input type="text" name="To"/> <br />
From <input type="text" name="From"/> <br />
Subject <input type="text" name="Subject"/> <br />
Body <textarea name="Body" rows="5" cols="20" wrap="physical" >
</textarea>
<input type="submit" />
</form>
</body>
</html>
And here is the code I have for my tizagEmail.aspx...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%# Page Language="C#"
'Sends an email
Dim mail
Set mail = Server.CreateObject("CDO.Message")
mail.To = Request.Form("To")
mail.From = Request.Form("From")
mail.Subject = Request.Form("Subject")
mail.TextBody = Request.Form("Body")
mail.Send()
Response.Write("Mail Sent!")
'Destroy the mail object!
Set mail = nothing
%>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 2</title>
</head>
<body>
<form id="form1" runat="server">
</form>
</body>
</html>
If someone could help me I would very much appreciate it.
Live long and prosper.
I think the best way to achieve what you want to do is to use a WebPart.
You should look at this tutorial about how to create a contact Form Web Part for SharePoint.
It looks like you've told the page to use C#, but Dim is a VB keyword.
So it looks like you've mixed up your languages.
You also seem to have mixed up Classic ASP and ASP.NET.
Classic ASP uses VB, ASP.NET uses C# and VB.NET.
Classis and .NET are very different.
Sending via ASP.NET
http://forums.asp.net/t/971802.aspx
Sending via classic asp: http://forums.iis.net/t/1144383.aspx

Error Creating Control vs2010 MasterPage

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.

Categories