Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

c#6

Posted on 2012-03-17
6
Medium Priority
?
256 Views
Last Modified: 2012-03-18
Not getting a response from the server side.  I cannot get the results to show.  I have made the changes suggested by the experts but no display on the server side.  I made the changes to the submit button a little concerned about that one.  Maybe too many arguments.  Please check that issue, the blank server side display, and any errors - please?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
        <title>Paycheck</title>
  </head>
<body>
    <script runat="server" >
        void Text1_onclick(object sender, EventArgs e)
        {
           
        }
        void Text1_onclick(object sender, EventArgs e)
        {
        }
        void Submit1_onclick(object sender, EventArgs e) {
             if (Text1.Value.Length < 1)
             {
                string error = "Please Enter a value in Hours Field ";
                string script = "alert(\"" + error + "\");";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "myScript", script , true);

              }
            else if(Text2.Value.Length < 1)
             {
                string error = "Please Enter a value in Pay Rate Field";
                string script = "alert(\"" + error + "\");";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "myScript", script , true);

              }
            else
             {
                string error = Convert.ToDouble(Text1.Value);
                string error = Convert.ToDouble(Text2.Value);
                string script = "alert(\"" + "\");";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "myScript", script, true,
                "Your Gross Pay is $ {0}" ,hours - 40 * rate * 1.5);
             }
             }
       </script>
    <form action="Default.aspx" method="post" runat="server">
    <p>Enter Hours Worked:<input id="Text1" type="text" onServerClick="Text1_onClick" runat="server" /></p>
    <p>Enter Pay Rate:<input id="Text2" type="text" onServerClick="Text2_onClick" runat="server" /></p>
    <p><input id="Submit1" type="submit" value="submit" onServerClick="Submit1_onclick" runat="server" /></p>
    </form>
</body>
</html>
0
Comment
Question by:assaultkitty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 18

Accepted Solution

by:
Rajar Ahmed earned 2000 total points
ID: 37734040
try this..
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
        <title>Paycheck</title>
  </head>
<body>
    <script runat="server" >
        void Text1_onclick(object sender, EventArgs e) 
        {
            
        }
        void Text2_onClick(object sender, EventArgs e)
        {

        }
        
        void Submit1_onclick(object sender, EventArgs e) {
            string error, script = "";
             double dOutput = 0;
            
             if (Text1.Value.Length < 1 )
             {
                 error = "Please Enter a value in Hours Field ";
                 script = "alert(\"" + error + "\");";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "myScript", script , true);

              }
             else if (!Double.TryParse(Text1.Value, out dOutput))
             {
                 error = "Please Enter Valid Numbers in Hours Field ";
                 script = "alert(\"" + error + "\");";
                 ClientScript.RegisterClientScriptBlock(this.GetType(), "myScript", script, true);
             }
            else if(Text2.Value.Length < 1)
             {
                 error = "Please Enter a value in Pay Rate Field";
                script = "alert(\"" + error + "\");";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "myScript", script , true);

             }

             else if (!Double.TryParse(Text2.Value, out dOutput))
             {
                 error = "Please Enter Valid Numbers in rate Field ";
                 script = "alert(\"" + error + "\");";
                 ClientScript.RegisterClientScriptBlock(this.GetType(), "myScript", script, true);
             }    
             
            else
             {
                 double  hours = Convert.ToDouble(Text1.Value);
                 double rate = Convert.ToDouble(Text2.Value);                
                 script = "alert(\"" + String.Format("Your Gross Pay is $ {0}" ,hours - 40 * rate * 1.5) + "\");";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "myScript", script, true);
              }
             }
       </script>
    <form id="Form1" runat="server">
    <p>Enter Hours Worked:<input id="Text1" type="text" onServerClick="Text1_onClick" runat="server" /></p>
    <p>Enter Pay Rate:<input id="Text2" type="text" onServerClick="Text2_onClick" runat="server" /></p>
    <p><input id="Submit1" type="submit" value="submit" onServerClick="Submit1_onclick" runat="server" /></p>
    </form>
</body>
</html>

Open in new window

0
 

Author Comment

by:assaultkitty
ID: 37734061
I am sorry.  It is not even going to the server side now.  It is on the same page.  Can u help me?
0
 
LVL 18

Expert Comment

by:Rajar Ahmed
ID: 37734073
In c#9 only i understood  what you are looking for . Pls chk.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:assaultkitty
ID: 37734094
thank you.
0
 

Author Comment

by:assaultkitty
ID: 37734095
I did not work.  Sorry.
0
 

Author Closing Comment

by:assaultkitty
ID: 37735232
Thank you.  I think there is something wrong with my IDE.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question