Becky Bloomwood

Becky Bloomwood

  • NA
  • 119
  • 285.8k

javascript in aspx

Jan 10 2011 12:03 AM

Hi, I try to paste a java script in the aspx file but it ends up having error. I google to see whether is there any other solutions but to no avail.
 <%@ Page Title="" Language="C#" 
MasterPageFile="~/common/BECMasterPage.master" AutoEventWireup="true" 
CodeFile="ViewCatalog.aspx.cs" Inherits="app_SD" %> 
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
 
    <asp:Panel ID="Panel1" runat="server" GroupingText="Search" Height="196px"
        Width="844px">
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
        <br>
        <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"
            Height="181px" Width="816px">
            <asp:TabPanel ID="TabPanel1" runat="server" HeaderText="Catalogue">
                <HeaderTemplate>
                    Template
                </HeaderTemplate>
                <ContentTemplate>
                    <table style="width: 100%">
                        <tr>
                            <td style="width: 98px">
                                Template ID</td>
                            <td>
                                <asp:TextBox ID="SearchTID" runat="server" BorderColor="Black"
                                    CssClass="aspTextBox01"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 98px">
                                Template Name</td>
                            <td>
                                <asp:TextBox ID="SearchTName" runat="server" BorderColor="Black"
                                    CssClass="aspTextBox01"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 98px">
                                <asp:Button ID="btnClear" runat="server" CssClass="aspButton01" Text="Clear" />
                            </td>
                            <td>
                                <asp:Button ID="btnSearch" runat="server" CssClass="aspButton01"
                                    PostBackUrl="~/app/BEC/CatalogSearch.aspx" Text="Search" />
                            </td>
                        </tr>
                    </table>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </ContentTemplate>
            </asp:TabPanel>
           
                </ContentTemplate>
            </asp:TabPanel>
           
        </asp:TabContainer>
       
       
        <br />
        </asp:Panel>
        </br>
         </br>
          </br>
           </br>
           </br>
           </br>
        <table border="1px">
        <tr>
        <td colspan="7">
            <b>Catalog View</b></td>
        </tr>
       
      
       
      
       
        <tr>
        <td style="width: 17px">
            <asp:CheckBox ID="checkall" runat="server" style="text-align: center" />
        </td>
        <td>
            &nbsp;</td>
        <td style="width: 109px">
            <b>Catalog Serial NO
          </b>
          </td>
          <td style="width: 122px">
              <b>catalog Name
          </b>
          </td>
         
          
         
        </tr>
       
      
       
      
       
       
      
       
      
       
        <tr>
        <td colspan="7">
        <asp:Button ID="btnAddTemplate" runat="server" Text="New"
            CssClass="aspButton01" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="btnUpload" runat="server" Text="Upload"
            CssClass="aspButton01" Enabled="False" />&nbsp;<asp:Button
            ID="btnCancel" runat="server"
            Text="Cancel"  CssClass="aspButton01" Enabled="False" /></td>
        </tr>
       
      
       
      
       
      
       
      
       
      
       
        </table>
</asp:Content>
<asp:Content ID="Content3" runat="server"
    contentplaceholderid="ContentPlaceHolder1">
            <table width="100%">
                <tr>
                    <td width="30%">
                        <asp:Image ID="Logo" runat="server" ImageUrl="~/images/Becky_logo.gif" />
                    </td>
                    <td width="40%" style="text-align:center; vertical-align:bottom;">
                       
                    </td>
                    <td width="30%" style="text-align:right; vertical-align:bottom;">
                        <asp:label ID="lblWelcomeMsg" runat="server" Text="" CssClass="asplbl02" ></asp:label>
                    </td>
                </tr>
              
            </table>
       
</asp:Content>

The above code is the aspx page.
 <script language="javascript" 
type="text/javascript">
$(document).ready(function()
{
$("#checkall").live('click',function(event){
$('input:checkbox:not(#checkall)').attr('checked',this.checked);
});

$('input:checkbox:not(#checkall)').live('click',function(event)
{
if($("#checkall").attr('checked') == true && this.checked == false)
$("#checkall").attr('checked',false);
if(this.checked == true)
CheckSelectAll();
});

function CheckSelectAll()
{
var flag = true;
$('input:checkbox:not(#checkall)').each(function() {
if(this.checked == false)
flag = false;
});
$("#checkall").attr('checked',flag);
}

});
 

</script>

this is the java script that once user selects the checkbox it will automatically checks all.
The code for the aspx is not full version. Questions is where do i place the javascript?
 
Thanks for ur help all these while. I appreciated it alot:D
 

Answers (4)