Click here to Skip to main content
15,887,027 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Get the first and last row for each child row Pin
AsianRogueOne4-Dec-09 5:07
AsianRogueOne4-Dec-09 5:07 
GeneralRe: Get the first and last row for each child row Pin
Abhishek Sur6-Dec-09 21:06
professionalAbhishek Sur6-Dec-09 21:06 
AnswerRe: Get the first and last row for each child row Pin
AsianRogueOne10-Dec-09 6:56
AsianRogueOne10-Dec-09 6:56 
QuestionHow to Trace variables ? [modified] Pin
alaminfad3-Dec-09 5:14
alaminfad3-Dec-09 5:14 
AnswerRe: How to Trace variables ? Pin
Gamzun3-Dec-09 8:14
Gamzun3-Dec-09 8:14 
QuestionHiding AJAX extender icon Pin
dptalt3-Dec-09 2:14
dptalt3-Dec-09 2:14 
AnswerRe: Hiding AJAX extender icon Pin
Abhishek Sur3-Dec-09 2:29
professionalAbhishek Sur3-Dec-09 2:29 
Questionusing javascript to check validation in aspx page Pin
Member 47041433-Dec-09 0:07
Member 47041433-Dec-09 0:07 
Hi all,

I am a beginner in javascript, and now I am trying to use it to check validation for an aspx page. I have a button and a textbox. When the button is clicked, the textbox will be checked wether it is empty or not.

I use the following code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript" runat="server">
      function checkValue2( obj)
{
    if (obj.value == "")
        alert ("empty");
    else
        alert ("not empty");
}
</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>              
        <asp:Button ID="Button1" runat="server" Text="Button"  onclick='checkValue2(forms[0].TextBox1)' />  
    </div>
    </form>
</body>
</html>


And this is the error:

Compiler Error Message: CS1001: Identifier expected

Source Error:



Line 7: <title>Untitled Page</title>
Line 8: <script type="text/javascript" runat="server">
Line 9: function checkValue2( obj)Line 10: {
Line 11: if (obj.value == "")

Could you tell me how can I fix this error?

Thank kiu so much!
AnswerRe: using javascript to check validation in aspx page Pin
Abhijit Jana3-Dec-09 0:21
professionalAbhijit Jana3-Dec-09 0:21 
GeneralRe: using javascript to check validation in aspx page Pin
Anurag Gandhi3-Dec-09 0:27
professionalAnurag Gandhi3-Dec-09 0:27 
GeneralRe: using javascript to check validation in aspx page Pin
Member 47041433-Dec-09 0:30
Member 47041433-Dec-09 0:30 
GeneralRe: using javascript to check validation in aspx page Pin
Abhijit Jana3-Dec-09 0:50
professionalAbhijit Jana3-Dec-09 0:50 
GeneralRe: using javascript to check validation in aspx page Pin
Abhishek Sur3-Dec-09 0:57
professionalAbhishek Sur3-Dec-09 0:57 
GeneralRe: using javascript to check validation in aspx page Pin
Abhijit Jana3-Dec-09 1:06
professionalAbhijit Jana3-Dec-09 1:06 
GeneralRe: using javascript to check validation in aspx page Pin
Abhishek Sur3-Dec-09 1:07
professionalAbhishek Sur3-Dec-09 1:07 
AnswerRe: using javascript to check validation in aspx page Pin
Abhishek Sur3-Dec-09 1:00
professionalAbhishek Sur3-Dec-09 1:00 
GeneralRe: using javascript to check validation in aspx page Pin
Member 47041433-Dec-09 16:37
Member 47041433-Dec-09 16:37 
GeneralRe: using javascript to check validation in aspx page Pin
Anurag Gandhi3-Dec-09 17:22
professionalAnurag Gandhi3-Dec-09 17:22 
QuestionFreezeHeader Pin
Anurag Gandhi3-Dec-09 0:00
professionalAnurag Gandhi3-Dec-09 0:00 
AnswerRe: FreezeHeader Pin
Abhijit Jana3-Dec-09 0:02
professionalAbhijit Jana3-Dec-09 0:02 
GeneralRe: FreezeHeader Pin
Anurag Gandhi3-Dec-09 0:23
professionalAnurag Gandhi3-Dec-09 0:23 
GeneralRe: FreezeHeader Pin
Abhijit Jana3-Dec-09 0:34
professionalAbhijit Jana3-Dec-09 0:34 
AnswerRe: FreezeHeader Pin
Abhishek Sur3-Dec-09 0:52
professionalAbhishek Sur3-Dec-09 0:52 
GeneralRe: FreezeHeader Pin
Anurag Gandhi3-Dec-09 0:56
professionalAnurag Gandhi3-Dec-09 0:56 
QuestionGreyBox Problem..... Pin
Anudeep Jaiswal2-Dec-09 23:31
Anudeep Jaiswal2-Dec-09 23:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.