Iron Speed Designer Help
 

Updated March 30, 2010
Iron Speed Designer V7.0 and later

The best way to send email from your application is by using Iron Speed Designer’s built-in send email action feature in the Property Sheet.  This requires no programming or custom code.

Programmatically sending an email

However, you can also programmatically send an email when a button is clicked in an application.  The easiest way to implement this is to override the Button_Click() method in the TableControl class.

Step 1:  Using the Application Wizard in Iron Speed Designer, create a set of application pages using a database table such as the Orders table in the Northwind database.

Step 2:  Use the Application Explorer to open the ShowOrdersTable.aspx page.

Step 3:  In the Layout Editor, select the Orders table panel and drag a Button control from the Toolbox onto the page next to the Export button.

Step 4:  Select the newly added Button control and set these properties via the Property Sheet:

Group

Property

Setting

[Application Generation]

Button action

Custom

Appearance

Text

myButton

Behavior

CausesValidation

Enable client-side validation

True

Step 5:  Override the Button_Click() method in the OrdersTableControl class, located in:

<Application Folder>\App_Code\Orders\ShowOrdersTable.Controls.cs or .vb

C#:

public override void Button_Click(object sender, EventArgs args)

{

     try

     {

          BaseClasses.Utils.MailSender email = new BaseClasses.Utils.MailSender();

          email.AddFrom("[email protected]");

          email.AddTo("[email protected]");

          email.AddBCC("[email protected]");

          email.SetSubject("Confirmation");

          email.SetContent("Thank you for your request");

          email.SendMessage();

     }

     catch (System.Exception ex)

     {

          BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "UNIQUE_SCRIPTKEY", ex.Message);

     }

}

Visual Basic .NET:

Public Overrides Sub Button_Click(ByVal sender As Object, ByVal args As EventArgs)

     Try

          Dim email As BaseClasses.Utils.MailSender = New BaseClasses.Utils.MailSender

          email.AddFrom("[email protected]")

          email.AddTo("[email protected]")

          email.AddBCC("[email protected]")

          email.SetSubject("Confirmation")

          email.SetContent("Thank you for your request")

          email.SendMessage()

     Catch ex As Exception

          BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(Me, "UNIQUE_SCRIPTKEY", ex.Message)

     End Try

End Sub

Step 6:  You may need to configure your email server authentication to accept emails sent from your application program.