Last post Jul 15, 2008 09:15 AM by waleefi
Jul 09, 2008 06:24 AM|waleefi|LINK
Jul 10, 2008 04:38 AM|Hua-Jun Li - MSFT|LINK
After you have add a post to the forum, please add the following code.
this.ClientScript.RegisterStartupScript(this.GetType(), "notification", "<script>window.alert('You have add the post to forum!')</script>");
It will pop a window to inform user of operating sucessfully.
Let me know if I have misunderstood what you mean.
Hope it helps,
Jul 10, 2008 07:32 AM|waleefi|LINK
Hi Hua, thanks for replying to my thread. Well, actually I was talking about the response of the page, let me explain more, for example when you add a post in any forum, you click the Add button to submit the page and post the data to the server, then you
get the response something like "You have successfully added the post" or whatever other message. My question was about how to generate the response message. Normally I use three panel or divs (with runat="server"), one for the controls (e.g. the textbox that
you type the post text in and the submit button .. etc) and another one for the notification message that should be sent to the user when the post is successfully added and a third one that contains an an error message if something goes wrong. I set the visible
property of both the notification and error message divs to false in the page code (in the tag), when the page is submitted I hide the div that contains the controls and show the div that contains the notification message if the post was added successfully
or show the div that contains the error message if something went wrong while trying to add the post. My question was like that, is there a better was for doing that? And I suggested two alternatives one of them by using Server.Transfer() (please read my first
post) .. thanks a lot for your reply, hopefully it's clearer now ...
Jul 14, 2008 06:04 AM|Hua-Jun Li - MSFT|LINK
As far as I know, the usual method is the following:
(1)You can only use one server control Label, you can give different value based on whether post is added successfully.
(2)Another method is to use the following method.
this.ClientScript.RegisterStartupScript(this.GetType(), "notification", "<script>window.open(notification.aspx)</script>");
You can give the notification at webpage notification.aspx.
Or use Server.Transfer(notification.aspx.);
The above method all is feasible.
Jul 15, 2008 09:15 AM|waleefi|LINK
not in the code behind file so that it can be edited easily, sure, I can use an inline server script block but this is something I don't really want to do, I prefer to keep my code in a code behind file. Well, I think I found a nice way though, there's a control
in ASP.NET 2.0 called MultiView which I never came across before, it allows you to define multiple views with only one view visible at a time, so, I could put the controls needed for adding the forum post in one view and the success notification message in
another view and I could also add another view for the error message in case something goes wrong, what a brilliant control! just exactly what I wanted!