开发者

ASP.NET: Sending E-Mail after Gridview Row Inserted

I have a two table like this;

Table Name: PROSPECT // Columns --> (CUSTOMER, YAT_ADET, FILO)

Table Name: TEMSILCI // Columns --> (CUSTOMER, MAIL)

Basicly, When I Inserted to Gridview 3 data for PROSPECT table, I want to send an e-mail to CUSTOMER. But Mail address data in TEMSILCI table. So, I should get, after the row inserted, CUSTOMER's mail address.

My SqlDataSource's InsertCommand is;

InsertCommand="INSERT INTO PROSPECT(CUSTOMER, YAT_ADET, FILO) VALUES (@CUSTOMER, @YAT_ADET, @FILO)"

I think, my scenario should;

  1. Get the CUSTOMER value which inserted to Gridview.
  2. Execute and get mail address with query like SELECT开发者_StackOverflow社区 MAIL FROM TEMSILCI WHERE CUSTOMER = 'Inserted CUSTOMER'
  3. After that, apply mail address to my already written SendMail() function.

I'm thinking to use RowInserted Event.

protected void ASPxGridView1_RowInserted(object sender, DevExpress.Web.Data.ASPxDataInsertedEventArgs e)
    {

    }

But how can I exactly do step 1 and 2 ? AND, How can I get SqlDataSource Inserted parameter's value programmatically?


You can capture the newly inserted data record's ID via the SCOPE_IDENTITY / @@IDENTITY function and combine a required email message. Refer to the http://www.devexpress.com/issue=Q299244 discussion in the DevExpress support center. Hope this helps.


I found the solution

protected void SqlDataSource11_Inserted(object sender, SqlDataSourceStatusEventArgs e)
    {
      string yatplan = cmd.Parameters["@YAT_PLAN"].Value.ToString();
    }

This code getting inserted value of YAT_PLAN column to ASPxGridview.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜