Solved

Script Manager is stoping my java script

Posted on 2008-10-16
4
584 Views
Last Modified: 2012-05-05
I am trying to put a simple java script function on my page but it will not work. Does script manager stop java script? How can I do a caculation for qty* unitprice?

<%@ Page Language="VB"  Debug="true"  %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Text.RegularExpressions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link href="../styles/rvistyle70.css" type="text/css" rel="STYLESHEET"/>
<script type="text/javascript" src="../ajax/ajax.js"></script>

<link href="http://192.168.1.113/po/rvistyle70.css" rel="stylesheet" type="text/css" />

<script runat="server">

   

   


       
   

   
   
         
 
   


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>INSERT PO</title>
    <SCRIPT language = JavaScript>

function priceTextBox_TextChanged() {
A = document.form1.qtyTextBox.value
B = document.form1.priceBox.value
C = (A + B)
alert("yes");
document.form1.extendedTextBox.text = eval(A*B)
}

</SCRIPT>
</head>
<body>
    <form id="form1" runat="server">
    <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>
   
    <div>
        <img src="http://www.otl-upt.com/Imagesdemand/images/otl_upt4.jpg" width="441" height="111" border="0"
        alt="Oklahoma Tank Lines / United Petroleum Transports"
        style="top: 15px; left: 300px; position: absolute"/><p>
            &nbsp;</p>
   
    </div>
    <hr style="top: 137px; left: 175px; position: absolute; height: 2px; width: 600px" />
       
<div id="title2"
        style="top: 167px; left: 150px; position: absolute; height: 8px; width: 700px">Purchase Order Entry</div>






<hr style="top: 850px; left: 150px; position: absolute; height: 2px; width: 700px" />

<a href="searchPO.aspx"
   
            style="display:block; top: 860px; left: 400px; position: absolute; height: 25px; width: 400px;">
     <img src="http://www.otl-upt.com/imagesDemand/images/button.gif" border="0" / ><font size="1">SEARCH/EDIT</font></a>
<a href="enterPO.aspx"
   
            style="display:block; top: 860px; left: 500px; position: absolute; height: 25px; width: 400px;">
     <img src="http://www.otl-upt.com/imagesDemand/images/button.gif" border="0" / ><font size="1">ENTER PO</font></a>
    <p>

   
   
    <asp:Label ID="Label1"
        style="display:block; top: 300px; left: 165px; position: absolute; height: 21px; width: 91px;"
        runat="server" Text="<b>Descripition:</b>"></asp:Label>

   
       
        </p>
   
   
    <p>

   
   
    <asp:DropDownList ID="csRepDropDown" runat="server"
       
        style="top: 250px; left: 260px; position: absolute; height: 22px; width: 135px; bottom: 92px; right: 386px;"  
        DataSourceID="SqlDataSource3" DataTextField="ContactName"
            DataValueField="ContactPkey"  
        AppendDataBoundItems="True"
        onselectedindexchanged="csRepDropDown_SelectedIndexChanged"
            ToolTip="Person approving this PO">
       
    </asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource7" runat="server"
                    ConnectionString="<%$ ConnectionStrings:UPT_DemoConnectionString %>"
                    SelectCommand="SELECT id, description FROM dbo.imtbl_asset">
                </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server"
            ConnectionString="<%$ ConnectionStrings:UPT_DemoConnectionString %>"
            SelectCommand="select a.description as ContactName,a.id as ContactID,a.pkey as ContactPkey,c.id,c.pkey as ContactTypePkey,e.description as Warehouse from imtbl_contact a inner join imtbl_contact_contact_type b on(a.pkey=b.contact) inner join imtbl_contact_type c on(b.contact_type=c.pkey) inner join imtbl_user_profile d on(a.id=d.user_id) inner join imtbl_warehouse e on(d.default_warehouse=e.pkey) order by c.id">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource6" runat="server"
                    ConnectionString="<%$ ConnectionStrings:UPT_DemoConnectionString %>" SelectCommand="SELECT      a.id, a.description
FROM         imtbl_contact a INNER JOIN
                      imtbl_contact_contact_type b ON a.pkey = b.contact
WHERE     (b.contact_type = 2)  order by a.description"></asp:SqlDataSource>
    <asp:Label ID="csRepLabel"
        style="display:block; top: 250px; left: 161px; position: absolute; height: 19px; width: 99px;"
        runat="server" Text="&lt;b&gt;Approved By:&lt;/b&gt;"></asp:Label>

        <asp:DropDownList ID="locationDropDown" runat="server"
           
           
            style="top: 250px; left: 575px; position: absolute; height: 22px; width: 135px"
            DataSourceID="SqlDataSource2" DataTextField="description"
            DataValueField="pkey"  
        onselectedindexchanged="locationDropDown_SelectedIndexChanged"
        AppendDataBoundItems="True"
            ToolTip="Which location will have this charged to their books">
           
        </asp:DropDownList>
       
       
       
        <asp:SqlDataSource ID="SqlDataSource2" runat="server"
            ConnectionString="<%$ ConnectionStrings:UPT_DemoConnectionString %>"
            SelectCommand="SELECT pkey as pkey,description as description FROM imtbl_warehouse">
        </asp:SqlDataSource>
       
       
       
        <asp:Label ID="locationLabel"
            style="display:block; top: 250px; left: 505px; position: absolute; height: 19px; width: 66px;"
            runat="server" Text="&lt;b&gt;Location:&lt;/b&gt;"></asp:Label>
    <asp:Label ID="SupplierLabel1"
        style="display:block; top: 420px; left: 201px; position: absolute; height: 17px; width: 58px;"
        runat="server" Text="&lt;b&gt;Vendor:&lt;/b&gt;"></asp:Label>
    <asp:Label ID="SupplierLabel0"
        style="display:block; top: 470px; left: 201px; position: absolute; height: 17px; width: 188px;"
        runat="server" Text="&lt;b&gt;Internal Trailer Cleaning?&lt;/b&gt;"></asp:Label>
    <asp:Label ID="loadLabel"
        style="display:block; top: 470px; left: 520px; position: absolute; height: 17px; width: 57px;"
        runat="server" Text="&lt;b&gt;Load #:&lt;/b&gt;" Visible="False"></asp:Label>
        <asp:TextBox ID="CityTextBox0" runat="server"
           
           
           
           
           
           
           
           
           
           
           
           
           
            style="top: 340px; left: 575px; position: absolute; height: 20px; width: 134px; margin-bottom: 6px;" >Oklahoma
        City</asp:TextBox>
        <asp:TextBox ID="zipTextBox" runat="server"
           
           
           
           
           
           
           
           
           
           
           
           
           
           
            style="top: 365px; left: 652px; position: absolute; height: 17px; width: 60px" >73129</asp:TextBox>
    <asp:TextBox ID="addressTextBox" multiline="yes" runat="server"
       
       
       
       
       
           
           
            style="top: 301px; left: 575px; position: absolute; height: 35px; width: 237px; margin-bottom: 0px;"
            TextMode="MultiLine">United Petroleum trans. 4312 South Georgia Place</asp:TextBox>

   
   
    <asp:TextBox ID="DescriptionTextBox" multiline="yes" runat="server"
       
       
       
       
       
           
           
            style="top: 300px; left: 260px; position: absolute; height: 85px; width: 128px"
            ToolTip="Description and Details of your PO" TextMode="MultiLine"></asp:TextBox>

   
   
    <asp:Label ID="Label2"
        style="display:block; top: 300px; left: 504px; position: absolute; height: 21px; width: 67px;"
        runat="server" Text="&lt;b&gt;Ship To Address:&lt;/b&gt;"></asp:Label>

   
       
        <asp:Label ID="locationLabel2"
            style="display:block; top: 340px; left: 534px; position: absolute; height: 17px; width: 37px;"
            runat="server" Text="&lt;b&gt;City:&lt;/b&gt;"></asp:Label>
       
       
       
        <asp:Label ID="locationLabel1"
            style="display:block; top: 365px; left: 625px; position: absolute; height: 22px; width: 27px; right: 314px;"
            runat="server" Text="&lt;b&gt;Zip:&lt;/b&gt;"></asp:Label>
       
       
       
        <asp:TextBox ID="supplierTextBox2" runat="server"
           
           
           
           
           
           
           
           
           
           
           
           
            style="top: 421px; left: 575px; position: absolute; height: 20px; width: 128px; margin-bottom: 1px;"
           
            ToolTip="You man enter a Document ID , Invoice Number, Sales Order Number or nothing at all" ></asp:TextBox>

   
       
        <asp:TextBox ID="loadNumberTextBox" runat="server"
           
           
           
           
           
           
           
           
           
           
           
            style="top: 471px; left: 576px; position: absolute; height: 18px; width: 128px"
            Visible="False"
            ToolTip="Please enter the Tanker Pro Order Number to attach this Cleaning" ></asp:TextBox>

   
       
        </p>

   
        <asp:DropDownList ID="stateDropDown" runat="server"
           
           
            style="top: 365px; left: 575px; position: absolute; height: 22px; width: 50px"
            DataSourceID="SqlDataSource4" DataTextField="description"
            DataValueField="id"  
         
        AppendDataBoundItems="True">
           
        </asp:DropDownList>
       
       
       
        <asp:SqlDataSource ID="SqlDataSource4" runat="server"
        ConnectionString="<%$ ConnectionStrings:UPT_DemoConnectionString %>"
        SelectCommand="select id,description from imtbl_state"></asp:SqlDataSource>
       
       
       
        <p>
       
       
       
        <asp:Label ID="locationLabel0"
            style="display:block; top: 365px; left: 525px; position: absolute; height: 19px; width: 43px;"
            runat="server" Text="&lt;b&gt;State:&lt;/b&gt;"></asp:Label>
       
       
       
        </p>

   
    <asp:CheckBox ID="cleaningCheckBox"
        style="display:block; top: 470px; left: 390px; position: absolute; height: 20px; width: 63px; right: 328px;"
        runat="server" oncheckedchanged="cleaningCheckBox_CheckedChanged"
        Text="Yes" AutoPostBack="True"
        ToolTip="Check here if this is an Internal Trailer Cleaning." />

   
    <asp:Label ID="SupplierLabel2"
        style="display:block; top: 422px; left: 480px; position: absolute; height: 17px; width: 95px;"
        runat="server" Text="&lt;b&gt;Reference #:&lt;/b&gt;"></asp:Label>

   
   
    <asp:SqlDataSource ID="SqlDataSource5" runat="server"
        ConnectionString="<%$ ConnectionStrings:UPT_DemoConnectionString %>"
       
        SelectCommand="SELECT a.issue_cost AS Cost, a.order_quantity AS qty, b.description, a.order_quantity AS Expr1, a.requested_by FROM dbo.imtbl_po_order AS a INNER JOIN dbo.imtbl_asset AS b ON a.asset = b.pkey WHERE (a.purchase_order &lt;&gt; @location)">
        <SelectParameters>
            <asp:ControlParameter ControlID="locationDropDown" DefaultValue=""
                Name="location" PropertyName="SelectedValue" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource8" runat="server"
        ConnectionString="<%$ ConnectionStrings:UPT_DemoConnectionString %>" SelectCommand="SELECT     a.issue_cost AS Cost, a.order_quantity AS qty, b.description, a.order_quantity AS Expr1, a.requested_by
FROM         imtbl_po_order a INNER JOIN
                      imtbl_asset b ON a.asset = b.pkey
WHERE     (a.purchase_order &lt;&gt; @newentry)">
       
    </asp:SqlDataSource>
   
   
           
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
         
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
                DataSourceID="SqlDataSource9" CssClass="style1"  AlternatingRowStyle-CssClass="style2"
                 
                 
                 
                 
               
                style="top: 580px; left: 150px; position: absolute; height: 103px; width: 700px; bottom: 161px;"
                AllowPaging="True"
               
               
                >
                <Columns>
                   
                    <asp:BoundField DataField="qty" HeaderText="qty" SortExpression="qty"  />
                    <asp:BoundField DataField="sessionID" HeaderText="sessionID"
                        SortExpression="sessionID" Visible="False" />
                    <asp:BoundField DataField="description" HeaderText="description"
                        SortExpression="description" />
                    <asp:BoundField DataField="unitPrice" HeaderText="unitPrice"
                        SortExpression="unitPrice" />
                    <asp:BoundField DataField="extendedAmount" HeaderText="extendedAmount"
                        SortExpression="extendedAmount" />
                    <asp:BoundField DataField="vehicleNumber" HeaderText="vehicleNumber"
                        SortExpression="vehicleNumber" />
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
                                CommandName="Delete" Text="Delete"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>

                   
                   
                   
                     

                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource9" runat="server"
                ConnectionString="<%$ ConnectionStrings:UPT_DemoConnectionString %>"
               
                SelectCommand="SELECT [sessionID], [description], [unitPrice], [extendedAmount], [vehicleNumber], [poNumber], [qty], [pkey] FROM [imtbl_templineitem]"
                DeleteCommand="DELETE FROM [imtbl_templineitem] WHERE [pkey] = @pkey"
                InsertCommand="INSERT INTO [imtbl_templineitem] ([sessionID], [description], [unitPrice], [extendedAmount], [vehicleNumber], [poNumber], [qty]) VALUES (@sessionID, @description, @unitPrice, @extendedAmount, @vehicleNumber, @poNumber, @qty)"
                UpdateCommand="UPDATE [imtbl_templineitem] SET [sessionID] = @sessionID, [description] = @description, [unitPrice] = @unitPrice, [extendedAmount] = @extendedAmount, [vehicleNumber] = @vehicleNumber, [poNumber] = @poNumber, [qty] = @qty WHERE [pkey] = @pkey">
                <DeleteParameters>
                    <asp:Parameter Name="pkey" Type="Decimal" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="sessionID" Type="String" />
                    <asp:Parameter Name="description" Type="String" />
                    <asp:Parameter Name="unitPrice" Type="Decimal" />
                    <asp:Parameter Name="extendedAmount" Type="Decimal" />
                    <asp:Parameter Name="vehicleNumber" Type="Decimal" />
                    <asp:Parameter Name="poNumber" Type="Decimal" />
                    <asp:Parameter Name="qty" Type="Decimal" />
                    <asp:Parameter Name="pkey" Type="Decimal" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="sessionID" Type="String" />
                    <asp:Parameter Name="description" Type="String" />
                    <asp:Parameter Name="unitPrice" Type="Decimal" />
                    <asp:Parameter Name="extendedAmount" Type="Decimal" />
                    <asp:Parameter Name="vehicleNumber" Type="Decimal" />
                    <asp:Parameter Name="poNumber" Type="Decimal" />
                    <asp:Parameter Name="qty" Type="Decimal" />
                </InsertParameters>
            </asp:SqlDataSource>
        </ContentTemplate>
   
   
       
   
   
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
        </Triggers>
   
   
       
   
   
    </asp:UpdatePanel>
   
       
           
   
   
   
   
   
    <asp:Button ID="ResetButton" runat="server" onclick="ResetButton_Click"
        style="top: 795px; left: 550px; position: absolute; height: 26px; width: 72px"
        Text="Clear Form" />
   
       
           
   
   
   
   
   
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="Data Source=OKCDB01;Initial Catalog=UPT_Demo;Persist Security Info=True;User ID=po_test;Password=mypassword"
        ProviderName="System.Data.SqlClient"
        SelectCommand="SELECT pkey, po_prefix, po_num, po_release_num, purchase_order_type FROM dbo.imtbl_purchase_order WHERE (warehouse = @warehouseid)">
        <SelectParameters>
            <asp:ControlParameter ControlID="locationDropDown" Name="warehouseid"
                PropertyName="SelectedValue" />
        </SelectParameters>
    </asp:SqlDataSource>
     
    <asp:DropDownList ID="vendorDropDown" runat="server"
        DataSourceID="SqlDataSource6"
        DataTextField="description"
        DataValueField="id" Height="22px"
        style="top: 420px; left: 260px; position: absolute; height: 22px; bottom: 92px;width: 129px; right: 392px;"
        ToolTip="Vendor providing that is providing the goods"  
        AppendDataBoundItems="True"
        >
                </asp:DropDownList>

   
    <HeaderTemplate>
        <table border="1" cellspacing="0" style="Z-INDEX: 101;
         LEFT: 150px;
         POSITION: absolute;  width:590px;
         TOP: 500px" cellpadding="5" align="center"  id="table4" >
          <tr>
          <th>QTY</th>
            <th>DESCRIPTION</th>
            <th>UNIT PRICE</th>
            <th>EXTENDED AMOUNT</th>
             
             <th>VEHICLE NUMBER</th>
             <th>ADD ITEM</th>
          </tr>
      </HeaderTemplate>
      <ItemTemplate>
           
           
          <tr class="style1">
           
            <td class="fontstyle" >
                <asp:TextBox ID="qtyTextBox" runat="server" Width="62px"
                    ToolTip="Qty of this item"></asp:TextBox>
              </td>
               <td class="fontstyle1"><asp:TextBox ID="descriptionItemTextBox" runat="server"
                       ToolTip="Description of this line item"></asp:TextBox>
                   </td>
            <td class="fontstyle1">
                <asp:TextBox ID="priceTextBox" runat="server" Width="66px"
                    ToolTip="Price of 1 of this paticular item" Onmouseout="priceTextBox_TextChanged"
                    ></asp:TextBox>
              </td>            
            <td class="fontstyle1">
                <asp:TextBox ID="extendedTextBox" runat="server" Width="88px"
                    ToolTip="Total for all of this line item"></asp:TextBox>
              </td>
           
            <td class="fontstyle1">
                <asp:DropDownList ID="vehicleDropDown" runat="server"
                    DataSourceID="SqlDataSource7" DataTextField="id"
                    DataValueField="id"
                    height="22"
                   
                    Width="120"  
                     AppendDataBoundItems="True"
                   
                    ToolTip="Choose the vehile you whish this line item to be attached to. If you do not what to attach this to a vehicle that please choose misc">
                </asp:DropDownList>
               
              </td>
            <td class="fontstyle1">
                <asp:Button ID="Button1" runat="server" Text="Add Item"
                    onclick="Button1_Click" UseSubmitBehavior="False" />
             </td>
           
          </tr>
      </ItemTemplate>
</table>
    <asp:Button ID="Button2" runat="server"
              style="top: 795px; left: 360px; position: absolute; height: 26px; width: 67px"
              Text="Insert PO" onclick="Button2_Click" />
    </form>
         
         
    </body>
</html>

0
Comment
Question by:soccerman777
  • 2
4 Comments
 
LVL 13

Expert Comment

by:crazyman
ID: 22734108
Whats this lonely line at the top

<script runat="server">

then continues with

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">

??
0
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 500 total points
ID: 22734303
scriptmanager does not stop your javascript from executing
you are trying to reference asp.net web controls by their ids directly from javascript which you cannot do

you need to use clientids for accessing controls in javascript
have a look at the following link for the same
http://www.c-sharpcorner.com/UploadFile/purankaushal/103222006013805AM/1.aspx?ArticleID=10c0cce3-e00f-4dad-9ddb-df0c669afd6c
0
 

Author Comment

by:soccerman777
ID: 22734567
sorry crazyman I just got back from lunch and someone else had the answer to my problem.    I cut a bunch of the code out so you could see just the essentials
0
 

Author Closing Comment

by:soccerman777
ID: 31506850
You got it. I also did not have () on my event call. Thanks I have only been programming asp.net for about 3 weeks. I was a cold fustion programmer  and asp.net is way more complex and picky.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to count occurrences of each item in an array.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now