如何在aspx页面中传递错误消息 [英] How to pass error message in aspx page

查看:54
本文介绍了如何在aspx页面中传递错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Team,



我的代码如下:



Hello Team,

I have the code below:

   [WebMethod]
        public static string GetDEOIDCount(object qcAllocationDetails)
        {
            string resultMessage = string.Empty;
            Result result = null;
            IQCAllocation qcallocation = QBpoEntityCreator.GetQCAllocationEntity();
            try
            {
                qcallocation = qcAllocationDetails.ConvertToJsonString().JsonToObject(qcallocation.GetType()) as IQCAllocation;
                DisplayDEOIDCount = QbpController.GetDEOIDCount(qcallocation).Entity.ConvertToJsonString();

if (DisplayDEOIDCount == "" || DisplayDEOIDCount == null)
                {
                    ////DisplayDEOIDCount = show the message : Count is not present
                }
                if (result != null && result.Error.GetCount() > 0)
                {
                    resultMessage = result.Error.GetAll();
                }

            }
            catch (Exception exception)
            {
                resultMessage = string.Format("Technical error ocurred. {0}. Please contact to system administrator.", exception.Message);
            }

            return DisplayDEOIDCount;

        }





我想在If条件下显示消息,如果count不存在

怎么可能。



请指导我

谢谢

Harshal。



I want to show the message in If condition ,if count is not present
How it is possible.

Please Guide Me
Thanks
Harshal.

推荐答案

您可以简单地将return语句放在将返回错误消息的catch块中。更多结束您可以使用您想要显示的任何内容修改错误消息。
You can simple put return statement in the catch block that will return the error message. More Over you can modify the error message with anything you want to display.


这篇关于如何在aspx页面中传递错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆