sandeep kumar

sandeep kumar

  • NA
  • 58
  • 12.7k

DetailsView Email Configuration

Aug 16 2018 11:40 AM
Hello Everyone,
 
I have code to get values from details view and send it user through email.
 
And I have 9 Rows in my detailsviews. When Ever user click edit and update it sends an email to list of users. Here in this case list of users getting email in such a way that in single email data of 9 rows values are apperaing 9 times in a single email.
 
Instead 9 times in a single email I want to only one time. And Below is my code.
 
Thanks In Advance
Sandeep
 
protected void DetailsView2_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
{
var dv = sender as DetailsView;
string bdy = $"Do Not REPLY To This Email.\n";
bdy += $"Communicate With Appropriate Department or Person.\n";
bdy += $"New Property Address has been added to the Database. \n";
bdy += $" \n";
bdy += $"{ComboBox1.SelectedValue.ToString()}\n";
foreach (var nEn in e.NewValues.Values)
{
bdy += $"Column1 : " + e.NewValues[0].ToString()+$" \n";
bdy += $"Column2: " + e.NewValues[1].ToString() + $" \n";
bdy += $"Column3 : " + e.NewValues[2].ToString() + $" \n";
bdy += $"Column4 : " + e.NewValues[3].ToString() + $" \n";
bdy += $"Column5 : " + e.NewValues[4].ToString() + $" \n";
bdy += $"%Column6 : " + e.NewValues[5].ToString() + $" \n";
bdy += $"Column7 : " + e.NewValues[6].ToString() + $" \n";
bdy += $"Column8 : " + e.NewValues[7].ToString() + $" \n";
bdy += $" \n";
bdy += $"Column9 : " + e.NewValues[8].ToString() + $" \n";
bdy += $" \n";
bdy += $" \n";
bdy += $"Thanks \n";
bdy += $"Database.\n";
bdy += $" \n";
bdy += $" \n";
}
string[] tolist = { "[email protected]" };
sendmail(tolist, tolist, bdy);
}

Answers (3)