Link to home
Start Free TrialLog in
Avatar of Serdar Demirkol
Serdar DemirkolFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.NET System.Windows.Forms.MessageBox

Hi,
Is there any downsides/problems adding a reference to System.Windows.Forms and using MessageBox on an ASP.NET form?

Many Thanks,
Avatar of Eyal
Eyal
Flag of Israel image

I don't think it will work. MessageBox is for windows forms and not for web forms
ASKER CERTIFIED SOLUTION
Avatar of Ajay Sharma
Ajay Sharma
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of santhimurthyd
you just can't. even if you try on your development PC and it appears to work, don't forget that when it will run on the IIS server, that code which is in the code behind and thus will show ... on the server!
Avatar of Serdar Demirkol

ASKER

The reason I want to use Wndows.MessageBox (as it does work); it is easy to take the client response and all happenning on client side.
Does anyone know any better way to take client response other than js alert and confirm as you cannot custimize these two.

Thanks,
in the web world, alert is the way to go!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
santhimurthyd:

Any ideas of picking the client response by server dinamically?

Thanks,
If you wish to trigger any event on Server side based on User input, that can be achieved by below stesp

i) Create an asp button
<asp:Button ID="Button1" runat="server" Text="Button" Style="display:none" OnClick="Button1_Click" />

ii) Create an event in the code behind

protected void Button1_Click(object sender, EventArgs e)
{
 //Your logical code you wish to do
}

iii) In the javascript

if(confirm("Are you wish to do"))
{
 document.getElementById("<%=Button1.ClientID %>").click();
}

check it out, whether it meets your requirment
I have also found below link very useful. Many Thanks

http://www.4guysfromrolla.com/articles/021104-1.aspx
I've requested that this question be closed as follows:

Accepted answer: 250 points for santhimurthyd's comment http:/Q_27480134.html#37243395
Assisted answer: 250 points for santhimurthyd's comment http:/Q_27480134.html#37243502
Assisted answer: 0 points for serdardmrk's comment http:/Q_27480134.html#37244698

for the following reason:

The link I have provided is exactly what I was looking for so everyone has similar issues would find it as the solution.
I posted same link in my first post, did you read that comment ???
Thanks serdardmrk for accepting the information and for your points.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ajaysharmaapjs:

Sorry (blaming the busy work), this must be where I have found it. I'll correct the points.