Hi,
I am showing my report in the web application using Report Viewer control.In the report i have start date and End date parameters.While running the report if i give startdate as '45/66/20007' it is displaying a message which is not user friendly.Is there is any way we can handle this type of errors and display our own custom error messages.
Thanks in advance
Hello Mahima,
I was facing the same problem but I solved it through strored procedures. I passed my custom message in the RaiseError exception after the validation.
Example : This is not a solution for your problem, but I think you change the validation accordingly
IF (DATEDIFF(MM,@.StartReceivedDate,@.EndReceivedDate) > 12)
BEGIN
SET @.DateErrMsg = 'The Date Range should fall with in an year, Please correct the range.'
RAISERROR (@.DateErrMsg,18,1)
END
Hope this helps.
|||
Hi,
I try to implement that when the condition occured, it is displaying like in this way:
Query execution failed for DataSet1.
An error occured during local report processing
under this our raise error message is displaying.
Is there any way only to display our message which in raise error other than first 2 lines.
Thanks in advance
|||I am using the (ReportErrorEventArgs e) from Microsoft.Reporting.WinForms namespace.
The way I have displayed our Raise Error exception is through the Message box.
Example:
MessageBox.Show(e.Exception.GetBaseException().Message, "Some message",MessageBoxButtons.OK, MessageBoxIcon.Error);
Then
I am hiding the " Query execution failed for DataSet1.
An error occured during local report processing
our raise error message is displaying."
with this expression : ReportErrorEventArgs.Handled = True.
In our requirement we need a messagebox to display ,but I am sure we can find a way to hide the first two lines and dispay only Raise Error execption message.
Hope this helps.....
|||Hi,
Can you please tell me in which event you are handling this.
Can you please give me the detailed example or any other link which speciefied this event handling.
Thanks in advance
|||It is the ReportError event for the ReportViewer.
private Microsoft.Reporting.WinForms.ReportViewer rptvSelReport;
Example:
private void rptvSelReport_ReportError(object sender, ReportErrorEventArgs e)
{
MessageBox.Show(e.Exception.GetBaseException().Message, DIALOG_FORM_CAPTION,MessageBoxButtons.OK, MessageBoxIcon.Error);
e.Handled = true;
Cursor.Current = Cursors.Arrow;
}
We have used this in our dev. environment and its working fine.
Let me know if you need any help....
|||Hi,
Thanks for the information.I will try this and i will ask you when i have problem with this,
Thanks
|||
No comments:
Post a Comment