•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 402,070 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,595 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 2085 | Replies: 13 | Solved
![]() |
•
•
Join Date: Sep 2007
Posts: 1,057
Reputation:
Rep Power: 3
Solved Threads: 61
vb.net:
C#:
MessageBox.Show("Your Message Here")StringBuilder str = new StringBuilder();
str.Append("<script language='javascript'>");
str.Append("alert('Your Message')");
str.Append("</script>");
RegisterStartupService("Msg",str.toString()); compiler cant found stringbuilder class since you didnt register the namespace. you can use the class' fully qualified name or you can use the using statement at the top of your code file like :
System.Text.StringBuilder s = new System.Text.StringBuilder();
or include the using statement above your class definition :
using System.Text;
then you wont get any compiler errors.
System.Text.StringBuilder s = new System.Text.StringBuilder();
or include the using statement above your class definition :
using System.Text;
then you wont get any compiler errors.
hi
as per my knowledge the best way for getting message box in asp.net project is creating a class and put there, following code.
'To display the message
Public Sub msgbox(ByVal msg As String, ByVal mypage As Page)
mypage.RegisterStartupScript("msg", "<script>alert('" & msg & "');</script>")
End Sub
then you can use this using object of this class any where in your project.
try this.
Best Luck.
as per my knowledge the best way for getting message box in asp.net project is creating a class and put there, following code.
'To display the message
Public Sub msgbox(ByVal msg As String, ByVal mypage As Page)
mypage.RegisterStartupScript("msg", "<script>alert('" & msg & "');</script>")
End Sub
then you can use this using object of this class any where in your project.
try this.
Best Luck.
try this :
<script>
function doValidation()
{
var text = document.getElementById('<%= Textbox1.ClientID %>').value;
var retVal = false;
//forexamle let say you wont allow text longer than 10 characters
if(text.length > 10)
{
alert("the text entered is not valid");
retVal = false;
}
else
{
retVal = true;
}
return retVal;
}
</script>
<asp:button runat="server" id="button1" value="validate" onclientclick="return doValidation()" />
<script>
function doValidation()
{
var text = document.getElementById('<%= Textbox1.ClientID %>').value;
var retVal = false;
//forexamle let say you wont allow text longer than 10 characters
if(text.length > 10)
{
alert("the text entered is not valid");
retVal = false;
}
else
{
retVal = true;
}
return retVal;
}
</script>
<asp:button runat="server" id="button1" value="validate" onclientclick="return doValidation()" />
Serkan Şendur
MCAD.NET
MCAD.NET
•
•
•
•
Thanks buddy! What if my script is C#? And I wish to create class for messagebox, I wish to repeatedly call it in any part of my program?
hi
i already provided you a code for creating a class for Message box in vb code.
you can get auto converted code from vb to c# using this link. try this...
http://labs.developerfusion.co.uk/co...arp-to-vb.aspx
Best Luck..
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
.net .net framework 3.0 access activation ajax api asp blogger blogging blogs code combo custom dani daniweb data debugging developer development dom dropdownlist gdata google gpl innovation key linux microsoft module net news office openbsd product programming reader reuse rss serial skin software source tags theme vista web windows workflow wysiwyg xml xoap
- Previous Thread: problem in creating menu bar in asp.net2003
- Next Thread: ASP.NET 2.0 equivalent Please



Linear Mode