Reputation: 265
I would like to display error msg in a label and for that I am using the code written below but it says "cannot convert type void to string."
catch (Exception ex)
{
conn.Close();
LblException.Text = Response.Write(ex.Message);
}
Is there a work around for this?
Upvotes: 0
Views: 858
Reputation: 2986
Response.Write
returns void
. What you want to be the text is ex.Message
: LblException.Text = ex.Message;
.
Upvotes: 4