| | |
Problem on MessageBox
![]() |
asp Syntax (Toggle Plain Text)
< %@ Page Language="C#" %> < script runat="server"> void AlertBtn_Click(object sender, EventArgs e) { string showmessage = "Test Message Box"; string alertScript = "< script language=JavaScript> "; alertScript += "alert('" +showmessage +"');"; alertScript += "< /script" +"> "; if (!IsClientScriptBlockRegistered("alert")) this.RegisterClientScriptBlock("alert", alertScript); } < /script> < html> < head> < /head> < body> < form runat="server"> < asp:Button id="btn" onclick="AlertBtn_Click" runat="server" Text="Button"> < /asp:Button> < /form> < /body> < /html>
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Feb 2008
Posts: 30
Reputation:
Solved Threads: 4
<script language="javascript" type="text/javascript">
function confirm()
{
if (confirm ==true)
else
return false;
}
</script>
then write in .aspx.cs
ButtonSave.Attributes.Add("onclick", "return confirm('Are you sure you proceed?');");
hope this code will help you out.
Thank tou
Jitesh
.Net Consulting
function confirm()
{
if (confirm ==true)
else
return false;
}
</script>
then write in .aspx.cs
ButtonSave.Attributes.Add("onclick", "return confirm('Are you sure you proceed?');");
hope this code will help you out.
Thank tou
Jitesh
.Net Consulting
•
•
Join Date: Feb 2008
Posts: 30
Reputation:
Solved Threads: 4
hi ebabes,
if you use the dropdownlist and add the number in to it, then there is no question of user making the mistake and so no need to prompt too..
Visual Basic code
Private flag As Boolean
Private Sub MyTextChangedHandler(sender As System.Object, e As System.EventArgs)
' Check the flag to prevent code re-entry.
If flag = False Then
' Set the flag to True to prevent re-entry of the code below.
flag = True
' Determine if the text of the control is a number.
If IsNumeric(textBox1.Text) = False Then
' Display a message box and clear the contents if not a number.
MessageBox.Show("The text is not a valid number. Please re-enter")
' Clear the contents of the text box to allow re-entry.
textBox1.Clear()
End If
' Reset the flag so other TextChanged events are processed correctly.
flag = False
End If
End Sub
Hope this will help you out.
Thank you
Jitesh
.Net Consulting
if you use the dropdownlist and add the number in to it, then there is no question of user making the mistake and so no need to prompt too..
Visual Basic code
Private flag As Boolean
Private Sub MyTextChangedHandler(sender As System.Object, e As System.EventArgs)
' Check the flag to prevent code re-entry.
If flag = False Then
' Set the flag to True to prevent re-entry of the code below.
flag = True
' Determine if the text of the control is a number.
If IsNumeric(textBox1.Text) = False Then
' Display a message box and clear the contents if not a number.
MessageBox.Show("The text is not a valid number. Please re-enter")
' Clear the contents of the text box to allow re-entry.
textBox1.Clear()
End If
' Reset the flag so other TextChanged events are processed correctly.
flag = False
End If
End Sub
Hope this will help you out.
Thank you
Jitesh
.Net Consulting
![]() |
Similar Threads
- Why i can't see my MessageBox? (C++)
- MessageBox (C++)
- WIN32 GUI application - Problem popping up dialog box (C++)
- Closed event of a form (C#)
- Please help me find problem in code :) (C#)
- owner form display problem (VB.NET)
- basic java GUI problem (Java)
- Big Problem, Generic Error (VB.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: use Timer in global.asax file
- Next Thread: Problems on hyperlink
Views: 1350 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.aspx .net 2.0 3.5 ajax appliances asp asp.net asp.net-mvc authentication blog browser button c# chat checkbox click complex connectionstring control crystal database datagridview datagridviewcheckbox datalist db deadlock deployment development dgv directshow dom download dynamic edit event-bubble-up feedback findcontrol flash form forms grid gridview hosting iframe iis iis-application impersonation india javascript knowledge-required languages list locahost-email login mac menu mobile mtom navigation novell offline opener opera picturebox problem profile redirect refresh remember-me response.redirect result richtext role save search server service session silverlight sql sql-server stop-sql-injection translate treeview trust-level update validation vb vb.net video view vista visual-studio visualstudio vs2008 web website xml xsl






