Using MsgBox in my Custom Web (Server-Side) Component
-
I want to output helpful messages to the user when they are input invalid vales into the various properties of the designer properties window. These will also "fire" when the properties in the component are read as the web-page containing the component is loaded into the designer editor. The problem is that when the page is rendered, the properties may "fire" off one of the messages, and this causes a page building fault indicating that I can't use the MsgBox. To get around this I built a wrapper on MsgBox that has a "no output" flag that I can toggle on and off in my code. Then I put toggled it off at the top of the Render and CreateChildControls subroutines, but sometimes I still get the page building fault. Are there other places I can add my code to turn off my MsgBox wrapper and prevent the fault? Also, I usually call to my MsgBox wrapper in a Try/Catch Block so that I can print out the more helpful message, but during the page building/render phase, I'd rather re-throw the exception and let that error be reported. So, is there some sort of variable or function call my code can look at to see if the page is being rendered?