G
Guest
I have a DetailsView control and when it get's updated i send an email
containing the new details. I have used the ItemUpdating event handler for
the DetailsView and i am populating the MailMessage.Body property with a
string variable which i build up using something like
String strMessageBody = "Field1 = " + e.NewValues["Field1"].ToString() +
"\nField2 = " + e.NewValues["Field1"].ToString();
This works fine apart from when one of the fields i am refering to is blank.
What i expected to happen is the e.NewValues["Field1"].ToString would give
me a blank string. However it seems that if the value coming from the
DetailsView is null for Field1 then e.NewValues["Field1"] doesn't exist.
Is there an easy way round this, i am putting the values of about 10 fields
into one string variable, i want to avoid 10
if (e.NewValues["Field1"] != null)
{
strMessageBody = strMessageBody + "Field1 = " +
e.NewValues["Field1"].toString();
}
containing the new details. I have used the ItemUpdating event handler for
the DetailsView and i am populating the MailMessage.Body property with a
string variable which i build up using something like
String strMessageBody = "Field1 = " + e.NewValues["Field1"].ToString() +
"\nField2 = " + e.NewValues["Field1"].ToString();
This works fine apart from when one of the fields i am refering to is blank.
What i expected to happen is the e.NewValues["Field1"].ToString would give
me a blank string. However it seems that if the value coming from the
DetailsView is null for Field1 then e.NewValues["Field1"] doesn't exist.
Is there an easy way round this, i am putting the values of about 10 fields
into one string variable, i want to avoid 10
if (e.NewValues["Field1"] != null)
{
strMessageBody = strMessageBody + "Field1 = " +
e.NewValues["Field1"].toString();
}