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
Related
I am generating pdf from this HTML, and for achieving this I am using https://www.nrecosite.com/pdf_generator_net.aspx
This is the HTML
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div>
<p>Remarks</p>
<p>한국어 발언을 표시하는 테스트입니다</p>
</div>
</body>
</html>
and this the code for generating the pdf:
var pdfBytes = new
NReco.PdfGenerator.HtmlToPdfConverter().GeneratePdf(html);
and the result is this:
how can I generate the pdf with the correct Korean utterances?
Thanks
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 am trying to add a view inside a Web form and its fine to show data. But I do a post it break. I have used LINK sample which I found on sof but it wont work for POST Request. Always throwing a MAC fail error.
Webforms typically uses a single form for the entire page. But HTML does not support nested forms, so if you put another form onto the page via MVC partial view, you need to ensure the partial view is not rendered inside of your <form runat="server"> tag.
Here is an example of using multiple forms with Webforms.
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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">
<fieldset>
<legend>ASP.NET web form (POST)</legend>
<asp:Label runat="server" AssociatedControlID="txtSearch">Name: </asp:Label><asp:TextBox runat="server" ID="txtSearch" /><asp:Button runat="server" ID="btnSend" Text="Search" OnClick="btnSend_Click" />
</fieldset>
</form>
<form method="get" action="Search.aspx">
<fieldset>
<legend>Regular HTML form using GET</legend>
<label for="name-text">Name: </label><input type="text" id="name-text" name="q" /><input type="submit" value="Search" />
</fieldset>
</form>
<form method="post" action="Search.aspx">
<fieldset>
<legend>Regular HTML form using POST</legend>
<label for="name-text2">Name: </label><input type="text" id="name-text2" name="q" /><input type="submit" value="Search" />
</fieldset>
</form>
</body>
</html>
NOTE: If your main webforms form is declared in a master page, you will need to render your MVC form inside of a separate ContentPlaceHolder control so the forms are not nested.
<!DOCTYPE HTML>
<html id="Html1" runat="server" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-1.xsd" xmlns:og="http://opengraphprotocol.org/schema/" >
<head id="Head1" runat="server">
<title>My Site</title>
</head>
<body id="Body1" runat="server">
<form id="frmMain" runat="server">
<!-- form for Webforms -->
<asp:ContentPlaceHolder id="MainContent" runat="server">
</asp:ContentPlaceHolder>
</form>
<!-- placeholder for external forms -->
<asp:ContentPlaceHolder ID="OutsideOfForm" runat="server">
</asp:ContentPlaceHolder>
</body>
</html>
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.
I have a HTML page that have an iframe. This iframe has a button. Which is one of the possibile ways to press that button?
I tried with javascript, but I didn't solve it...
Thank you in advance!
hey you can try to find that button id and handle the click event..
it will look something like this.
$('#youriframeid').contents().find('#yourbuttonid').click(function(){});
EDIT
Your main html page containing iframe.
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.0.min.js" type="text/javascript"> </script>
<script>
$('#a').contents().find('#iframbtn').click(function(){alert("It Worked!")});
$('#a').contents().find('#iframbtn').trigger('click');
</script>
</head>
<iframe id="a" source="a.html">
</iframe>
</html>
Your second html page containing iframe mark up
<html>
<input type="button" id="iframbtn" value="clickme"/>
</html>
Try to use this:
$("#mainiframe").contents().find("someID").trigger("click");
Sample1.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<script>
function call(){
try{
document.frm.but.click();
}catch(e){
}
}
</script>
<BODY onload ="call()">
<iframe src="Sample2.html" name="frm" width=100 height=100 />
</BODY>
</HTML>
Sample2.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<script>
function called(){
alert("---DONE--");
}
</script>
<BODY>
<input type="button" name="but" value="submit" id="but" width=60 height=60 onclick="called()" />
</BODY>
</HTML>
Hope this helps you.