|
 |
aspx thread: Re : Message Box in ASP.NET
Message #1 by hisunilj@y... on Fri, 25 Jan 2002 05:49:05
|
|
Hello All,
Thanx to the reply for my posts. Well my problem is slightly different and
i will elaborate now :
=> I have surfed the bipinjosh site and used that script "Response.Write
("<script language=javascript>alert('could not delete')</script>");"
the problem occurs in the place of /Script, as CSharp compiler (as its the
language of the page) treats "/" as a new line character and throws an
error.
I have also tried that script "Response.Write("<script
language=javascript>alert('could not delete')<//script>");" the error
disappears but the message is also not displayed and in the view source,
it is printed as it is.
<script language=javascript>
alert('could not delete')
<//script>
=> I tried using aspvalidator, but it has its own problam as it
requires "ControlToValidate", and fires only on that control.
=> now i am using plain Response.write to display the message. This is
having a problem as it displays the response.write in the first compile
itself and without any action, the message is displayed.
=> what i want is there is a datagrid with a checkbox in it against each
record and a Delete button at the top (like we have in the Web Mail
interfaces). What i want to do is when the person checks 3-4 checkboxes
and clicks on the delete button, then if theres some error at the backend,
it should display the error message, which is not being displayed by the
Javascript (bipinjoshi.com) solution.
I hope i have made the situation clear!!
Thanking you in advance!!
Warm Regards
SuniL
Message #2 by hisunilj@y... on Fri, 25 Jan 2002 07:30:36
|
|
Heres a sample code for my app to work
<%@ Page Language="C#" %>
<html>
<script runat="server">
void SubmitBtn_Click(Object sender, EventArgs e)
{
if (Name.Value == "sunil " && Password.Value == "sunil")
Response.Write(@"<script language='javascript'>You are
authenticated</script>");
else
Response.Write(@"<script language='javascript'>Incorrect user
name or password</script>");
}
</script>
<body>
<form method=post runat="server">
Enter Name:
<input id="Name"
type=text size=40 runat="server">
Enter Password:
<input id="Password"
type=password size=40 runat="server">
<input type=submit value="Enter" name="btn"
OnServerClick="SubmitBtn_Click" runat="server">
<input type=reset
runat="server">
</form>
</body>
</html>
Heres the error thrown by the compiler :
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: CS1010: Newline in constant
Regards
SuniL
|
|
 |