Click to See Complete Forum and Search --> : how to use message box in asp.net?
karthik_balus
March 23rd, 2006, 03:00 AM
How to use Message box in asp.net...
I know that we can use alert ans conform method... But i wanna know the members of alert and conform methods...
I have a problem in my aplication using this alert method...
I used this alert method inside the buton eevent...
Button1.Attributes.Add("onclick","return alert('This is my message';")
This is the code i used...
Suppose i need the message box to be printed inside the button event means... WE need to chick the button twice to get he message... I need the message when it is chicked once...
Please help me out in this....
Thanks in advance..
regards
karthik
mmetzger
March 23rd, 2006, 09:43 AM
I don't entirely understand what you're after - if you want them to click the button, change the message on the button, then if they click again submit - you're going to have to do some Javascript management to make that happen. It might be best to create your own button control and override the render method to include the necessary script automatically.
tal_181
March 24th, 2006, 08:43 PM
Response.Write("<script>alert('Hello');</script>")
Roles
March 27th, 2006, 04:07 AM
I also don't understand everything you're telling but you could also use this
Sub btn_click(sender As Object, e As EventArgs)
text1.text = "Deleted"
End Sub
Sub page_load (s as object, e as eventargs )
Dim msg As String
msg = "return confirm('Are you sure you want to Delete?');"
btn.Attributes.Add("onclick", msg)
End Sub
<form runat="server">
<asp:Button ID="btn" Text="klik" OnClick="btn_click" runat="server"/>
<asp:TextBox ID="text1" runat="server" />
</form>
Shuja Ali
March 27th, 2006, 04:21 AM
How to use Message box in asp.net...
I know that we can use alert ans conform method... But i wanna know the members of alert and conform methods...You will need to have Clientside Javascript to get a messagebox Both alert and confirm have just one parameter and that is the message that you want to display. alert will just show the message with an Ok button however confirm (http://www.tizag.com/javascriptT/javascriptconfirm.php) will show Ok and Cancel buttons alongwith the message.
I have a problem in my aplication using this alert method...
I used this alert method inside the buton eevent...
Button1.Attributes.Add("onclick","return alert('This is my message';")
This is the code i used...
Suppose i need the message box to be printed inside the button event means... WE need to chick the button twice to get he message... I need the message when it is chicked once... The reason why you need to Click the button twice to get the message box is because you are registering the Javascript function on the click of the button. This means the Javascript will only be rendered in the client when you click the button. So when you load the page at first the javascript will not be there. This needs to be done in the Page_Load event, so that the Javascript function gets registered when the page is loaded. This has been shown in the above post.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.