944,157 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 16918
  • ASP.NET RSS
Jun 16th, 2007
0

Exit code and prompting message box

Expand Post »
hello everyone,
how to write exit code in visual studio.Net so that whole program closes on button click event?
And how Message box is created, also how to take input from user as we do in javascript using prompt command?
Can anyone help me in this.....
Thanx in advance.
Similar Threads
Reputation Points: 23
Solved Threads: 1
Light Poster
ruhi is offline Offline
25 posts
since Jun 2007
Jun 18th, 2007
0

Re: Exit code and prompting message box

i got the exit code. i am writing here if it helps anyone..
this will be written within button click event
ASP.NET Syntax (Toggle Plain Text)
  1. Response.Write("<script>window.close();</script>")
And also like below we can write by assigning attribute.
This we will write in page load event
ASP.NET Syntax (Toggle Plain Text)
  1. Button1.Attributes.Add("OnClick", "window.close();")
This both codes will close the window we are using on clicking the exit button.

But still i dont noabout message box with taking the input from user can anyone help me in that...
Reputation Points: 23
Solved Threads: 1
Light Poster
ruhi is offline Offline
25 posts
since Jun 2007
Jun 18th, 2007
0

Re: Exit code and prompting message box

Click to Expand / Collapse  Quote originally posted by ruhi ...
hello everyone,
how to write exit code in visual studio.Net so that whole program closes on button click event?
And how Message box is created, also how to take input from user as we do in javascript using prompt command?
Can anyone help me in this.....
Thanx in advance.

hi ruhi
this is naman.
well your quest is very nice.

if you r talking about vb.net then there is one function "END()"
write it in to the button click event.
and for the message box.
there is one function "msgbox("your message")" write it anywhere in any button click or the page load event.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
naman sisodia is offline Offline
2 posts
since Jun 2007
Jun 18th, 2007
0

Re: Exit code and prompting message box

Actually i m using visual studio .net but thanks for your reply naman and i just got the answer.If any one would like to refer...
In the parent page we will have say one textbox and one button then the code for it is
parent.aspx
in html code we have
ASP.NET Syntax (Toggle Plain Text)
  1. <asp:TextBox id="first" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 24px" runat="server"></asp:TextBox>
  2. <asp:Button id="Input" style="Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 24px" runat="server" Text="Open..."></asp:Button>
and parent.aspx.vb
in page load event we will write
ASP.NET Syntax (Toggle Plain Text)
  1. Input.Attributes.Add("onclick", "var strReturn; strReturn=window.showModalDialog('child.aspx',null,'status:no;dialogWidth:370px;dialogHeight:220px;dialogHide:true;help:no;scroll:no');if (strReturn != null) document.getElementById('first').value=strReturn;")

And suppose child page
child.aspx
if it contains one textbox and two buttons again in html window
ASP.NET Syntax (Toggle Plain Text)
  1. <asp:TextBox id="second" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 24px" runat="server"></asp:TextBox>
  2. <asp:Button id="btnOK" style="Z-INDEX: 103; LEFT: 48px; POSITION: absolute; TOP: 56px" runat="server" Text="Ok" Width="56px"></asp:Button>
  3. <asp:Button id="btnCancel" style="Z-INDEX: 102; LEFT: 112px; POSITION: absolute; TOP: 56px" runat="server" Text="Cancel"></asp:Button>
and child.aspx.vb will have in the page load event
ASP.NET Syntax (Toggle Plain Text)
  1. btnOK.Attributes.Add("onclick", "window.returnValue = document.getElementById('second').value; window.close();")
  2.  
  3. btnCancel.Attributes.Add("onclick", "window.close();")
Complete.
Reputation Points: 23
Solved Threads: 1
Light Poster
ruhi is offline Offline
25 posts
since Jun 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: plz help me out soon
Next Thread in ASP.NET Forum Timeline: How to find the left value of <TD>





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC