How to run this when the button is pressed?

  • Thread starter Thread starter Curt_C [MVP]
  • Start date Start date
Sorry, but i got completly lost by your answer.
I didn't understand how that can run the insert data to database code and
after it the send data by email.
 
No. The strange thing is i know all that. I just don't know how to give the
order to make all that work when i click the last button of the multipage.

Usually to send the form values using the email i give the order in the
button:
<asp:Button ID="send" runat="server" OnClick="sendEmail" Text="Send"
Width="160" />

And to insert values in database i put this code in the end of the form:
<input type="hidden" name="MM_insert" value="dadosForm">

My problem is how to make both things run when the last button on the
Multipage is pressed.

The script i have for this button is:

it send to email?
This is basicly the Big Question!
End Sub

Thanks,
Miguel
 
BTW, could you check your computer's clock and/or time zone setting?
 
private void SendMail()
{
....code here
}
private void WriteToDB()
{
....code here
}

And then in the Click event
{
SendMail();
WriteToDB();
}

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


Miguel Dias Moura said:
No. The strange thing is i know all that. I just don't know how to give the
order to make all that work when i click the last button of the multipage.

Usually to send the form values using the email i give the order in the
button:
<asp:Button ID="send" runat="server" OnClick="sendEmail" Text="Send"
Width="160" />

And to insert values in database i put this code in the end of the form:
<input type="hidden" name="MM_insert" value="dadosForm">

My problem is how to make both things run when the last button on the
Multipage is pressed.

The script i have for this button is:

after
it send to email?
This is basicly the Big Question!
End Sub

Thanks,
Miguel



Curt_C said:
it was to show you how to retrieve the form values....isnt' that where you
were stuck?
You said you knew how to insert and send the e-mail.....
Or am I missing something here?

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


added
to at
end) database
and
System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRINGSystem.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABA
IIf((Request.Form("Field1")
IIf((Request.Form("Field2")
IIf((Request.Form("Field3")
used
it
 
Hello,

I am working in ASP.net / VB with Access Database.

i have a Multipage in my web site with the Submit button as the last button.

When the Submit button is pressed i want the form values to be added to a
database and sent by email.

1. I have the code which submits the form values to the database. (See at
end)

2. I have the script which sends the email using AspNetMail (See at end)

3. I have the script which detects when the Submit button is pressed:

<script runat="Server">

Sub btnSubmit_Click( s As Object, e As EventArgs )
after it send to email?
This is basicly the Big Question!

End Sub



CODE which inserts form values in database:
(I didn't test it yet but i think everything is allright.)

<MM:Insert
runat="server"
CommandText='<%# "INSERT INTO explicador (Field1, Field2, Field3)
VALUES (?, ?, ?)" %>'
ConnectionString='<%#
System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING
_connSite") %>'
DatabaseType='<%#
System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABA
SETYPE_connSite") %>'
Expression='<%# Request.Form("MM_insert") = "formValues" %>'
CreateDataSet="false"
Debug="true"<Parameters>
<Parameter Name="@Field1" Value='<%# IIf((Request.Form("Field1") <>
Nothing), Request.Form("Field1"), "") %>' Type="WChar" />
<Parameter Name="@Field2" Value='<%# IIf((Request.Form("Field2") <>
Nothing), Request.Form("Field2"), "") %>' Type="WChar" />
<Parameter Name="@Field3" Value='<%# IIf((Request.Form("Field3") <>
Nothing), Request.Form("Field3"), "") %>' Type="WChar" />
</Parameters>
</MM:Insert>


Script which sends form values using AspNetEmail:

<script runat="server">

Private Sub sendEmail(sender as Object, e as System.EventArgs)

I omit the code as it to extensive but it's working as i used it many
times...

End Sub

</script>

Thank You Very Much,
Miguel
 
Back
Top