Reputation: 23
I want to show a message box when users trying to do any major operations in my web part. If user choince [Yes], then continue to do sometiing ...[No] for nothing.
How can i implements this function in my web part , Sharepoint 2007 ??
pls help me ~~
thx
Upvotes: 1
Views: 3337
Reputation: 848
If you're using an ASP.Net control like a Button, you can add the following attribute to give the user a JavaScript popup before the postback actually happens:
<asp:Button runat="server" ID="Button1" OnClick="Button1_Click" OnClientClick="return confirm('Are you sure you want to do this?');" />
You can also set this property on the button object in your code:
Button1.OnClientClick = "return confirm('Are you sure you want to do this?');";
Upvotes: 4