Archive
Send Email from a Static HTML
Send an email without back-end/server side code.
There are many solutions available for sending an email here I am explaining steps to sending an email from html page using Google Apps mail.
1. Make a Copy of the Sample Spreadsheet.
Sample: https://docs.google.com/spreadsheets/d/1Bn4m6iA_Xch1zzhNvo_6CoQWqOAgwwkOWJKC-phHx2Q/
2.Open the Script Editor
Open the Script editor… by clicking “Tools” > “Script editor…”
3. Set the TO_ADDRESS
in the Script
4. Save a New Version of your Script
Goto File-> Manager Version option to set Version
5. Publish the Updated Script as a Web App
Goto menu Publish-> Deploy as Web app option to publish
Select the latest project version to deploy:
6. Authorize the Script to Send Emails
Click Continue to authorize this app
Copy the web app URL to your clip board / note pad. Then Click “OK”.
7. Create your basic HTML Form
8. Open the HTML Form (page) in your Browser
Fill in some sample data in the HTML Form:
Submit the form. You should see a confirmation that it was sent like
{“result”:”success”,”data”:”{\”color\”:[\”\”],\”name\”:[\”Rahul\”],\”message\”:[\”This is test \”],\”email\”:[\”rahulgbhatia@live.com\”]}”}
Alternate solution : Use Ajax to submit the form
Hope this help !
Background Reading
- Google Apps Scripts Basics: https://developers.google.com/apps-script/articles
- Logger (like console.log): https://developers.google.com/apps-script/reference/base/logger
- Simple Mail Merge using Google Spreadsheets: https://developers.google.com/apps-script/articles/mail_merge
- Original Tutorial: AJAX post to google spreadsheet: http://stackoverflow.com/questions/10000020/ajax-post-to-google-spreadsheet which points to:
How to create a Pie chart using ASP.Net and C#
There are 4 things you need to do in order to get this configured and working on your machine, remember, however that you will need Visual Studio 2010 and .Net 4. |
|
I’ll assume you know how to create a Website project…File, New, Website, ASP.Net project… |
The Web.Config file needs to be modified to contain the httpHandler and controls. These configurations enable the asp:Chart tag which is used in the Default.aspx file. |
<httpHandlers>
<add path=
"ChartImg.axd"
verb=
"GET,HEAD,POST"
type="System.Web.UI.DataVisualization
.Charting
.ChartHttpHandler,S
ystem.Web.DataVisualization,
Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
validate=
"false"
/>
</httpHandlers>
<controls>
<add tagPrefix=
"asp"
namespace
=
"System.Web.UI.DataVisualization.Charting"
assembly="System.Web.DataVisualization,
Version=4.0.0.0,
Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
</controls>
In the Default.aspx file we will add the chart, titles, legend, series and chartareas. |
<asp:chart id=
"Chart1"
runat=
"server"
Height=
"300px"
Width=
"400px"
>
<titles>
<asp:Title ShadowOffset=
"3"
Name=
"Title1"
/>
</titles>
<legends>
<asp:Legend Alignment=
"Center"
Docking=
"Bottom"
IsTextAutoFit=
"False"
Name=
"Default"
LegendStyle=
"Row"
/>
</legends>
<series>
<asp:Series Name=
"Default"
/>
</series>
<chartareas>
<asp:ChartArea Name=
"ChartArea1"
BorderWidth=
"0"
/>
</chartareas>
</asp:chart>
And lastly, we will add the code to the code-behind file to populate and configure the chart. First thing I do is to load the data values for the chart. If this was implemented in a program being used to represent real data, then the values would not be hardcoded. You would connect to a database, run a query and then have your business logic create the contents of the values. For simplicity, I hard coded the values. Then I simply went through and set the properties that created the above Pie Chart. |
protected
void
Page_Load(
object
sender, EventArgs e)
{
double
[] yValues = { 71.15, 23.19, 5.66 };
string
[] xValues = {
"AAA"
,
"BBB"
,
"CCC"
};
Chart1.Series[
"Default"
].Points.DataBindXY(xValues, yValues);
Chart1.Series[
"Default"
].Points[0].Color = Color.MediumSeaGreen;
Chart1.Series[
"Default"
].Points[1].Color = Color.PaleGreen;
Chart1.Series[
"Default"
].Points[2].Color = Color.LawnGreen;
Chart1.Series[
"Default"
].ChartType = SeriesChartType.Pie;
Chart1.Series[
"Default"
][
"PieLabelStyle"
] =
"Disabled"
;
Chart1.ChartAreas[
"ChartArea1"
].Area3DStyle.Enable3D =
true
;
Chart1.Legends[0].Enabled =
true
;
}
How to find control with in repeater on button click event
<asp:Repeater ID=”RptInfo” runat=”server”>
<ItemTemplate>
<asp:Panel ID=”pnlReadonly” runat=”server”>
….
</asp:Panel>
</ItemTemplate>
</asp:Repeater>
Code :
Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Dim pnlReadonly As Panel = DirectCast(RptSoccerInfo.Items(0).FindControl(“pnlReadonly”), Panel)
If (Not pnl Is Nothing) Then
‘ some code
End If
End Sub
Will add some more detail soon .
Cannot drop database because it is currently in use.
This is a very common error when DROP Database is command is executed and the database is not dropped.
The following commands will raise above error:
USE AdventureWorks;
GO
DROP DATABASE AdventureWorks;
GO
Solution:
The following commands will not raise an error and successfully drop the database:
USE Master;
GO
DROP DATABASE AdventureWorks;
GO
If you are still getting the error after you try using
use master
go
drop database (databaseName)
go
Close SQL Server Management Studio completely. Open it again and connect as normal. Now you will be able to drop the database with
use master
go
drop database (databaseName)
go
Hope it helps!
Validate INDIAN PAN Number Using Regular expression
Indian PAN is as follows: AAAAA9999A:
Where First five characters are letters, next 4 numerals, last character letter
One rule there the fourth character is choosen from a list Alphabates as bellows.
C – Company
P – Person
H – HUF(Hindu Undivided Family)
F – Firm
A – Association of Persons (AOP)
T – AOP (Trust)
B – Body of Individuals (BOI)
L – Local Authority
J – Artificial Juridical Person
G – Govt
http://en.wikipedia.org/wiki/Permanent_account_number
Hence I will create a regular expression
as bellow
^[\w]{3}(p|P|c|C|h|H|f|F|a|A|t|T|b|B|l|L|j|J|g|G)[\w][\d]{4}[\w]$
Here I have a textbox and a regular expression validator in my aspx page as bellow.
<asp:TextBox ID="txtPan" runat="server" ></asp:TextBox> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="txtPan" runat="server" ErrorMessage="Invalid PAN" ValidationExpression="^[\w]{3}(p|P|c|C|h|H|f|F|a|A|t|T|b|B|l|L|j|J|g|G)[\w][\d]{4}[\w]$"> </asp:RegularExpressionValidator>
Comments