Once the databind is completed, I fire off the databound event. I wanted to catch any error that might have occurred so I dont run the StoredProc "sp_UpdatePrintQueueToPrinted".

How do I Catch errors on/before DataBound event?

        protected void ListView1_DataBound(object sender, EventArgs e)
    {
        using (GPEntities gpe = new GPEntities())
        {
            gpe.sp_UpdatePrintQueueToPrinted();              
        }
    }
有帮助吗?

解决方案

Note that OnDataBound occurs when databinding ends. OnDataBinding occurs as soon as data binding begins.

Are you trying to catch errors relating to the actual databinding itself? If so, wrap your .DataBind() event with a try catch statement. Or is there some other incidental error that you are tracking as a result of the databinding?

其他提示

You could use OnDataBinding event which kicks in... on data binding =) (before databound event)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top