There is no solution using messagebox. Remember that you are coding a serverside application not a desktop one. Any code that you write is run on the server. Some of that code in the case of a webform sends a stream of data down to the client where the browser looks at the data stream and renders that data stream as the browser sees fit.
So when you want something to happen on the client you add a control on the serverside that appends data onto that data stream that is being sent down. Or you can manually add data to that stream. One of the methods you can do that is to use the RegisterStartupScript command.
What this does is to append the exact string you send down right before the closing tag for the form. In most cases I have seen so far this is used to send down a piece of javascript. The browser then see's that javascript and does something with it.
Sorry for being so simplistic here but it really helps if you can understand this concept.
Now in your case we aren't going to use RegisterStartupScript. We are still going to append some data to that stream going to the client, just using a different method.
We are going to use the attributes property that every server control has. The following code should be placed in the page_load event under a not ispostback check.
Button1.Attributes.Add("onclick", "return (confirm('do you want to?'))"
Now to explain. Attributes is a collection so we access the add method of that collection to add an attribute. Simple enough. The parameters for an add include the
Key and the
Value. The key you want to specify is onclick for the javascript onclick event. The value is what we want to happen on click. Basically a confirm message box. By putting return in front we decide what will happen next. Should the client click
Cancel in the messagebox the clientside onclick returns a false and so does not submit the form. If the client clicks
OK then onclick returns true and the form is submitted.
Then server side in the event handler for the button you can add the Category and display the Product panel.
Do the same thing for the product ok button as we did here and you'll be fine.
I definetely hoped this helped ya my fingers are tired. j/k
Good luck
That'l do donkey, that'l do
![[bravo] [bravo] [bravo]](/data/assets/smilies/bravo.gif)
Mark
If you are unsure of forum etiquette check here faq796-2540