.NET Generates JavaScript errors for all my DataGrids all the sudden. HELP >>>>>>

Discussion in 'ASP .Net' started by Andrzej Wegrzyn, Aug 18, 2003.

  1. Hi,

    I had a portal that worked before, and over 5 months period JavaScript
    errors started to show up on all forms where I have datagrids.

    Using: IE 6.0, WIN XP, IIS 5.1, Framework 1.1

    error: Expected ';'


    The only JavaScript there is given to my by .NET:

    <script language="javascript">
    <!--
    function __doPostBack(eventTarget, eventArgument) {
    var theform;
    if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
    theform = document.forms["ZoneList:_ctl0"];
    }
    else {
    theform = document.ZoneList:_ctl0;
    }
    theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
    theform.__EVENTARGUMENT.value = eventArgument;
    theform.submit();
    }
    // -->
    </script>

    This is the datagrid:

    <asp:DataGrid id="MyList" runat="server" width="55%"
    BorderColor="#ffffff"
    GridLines="none"
    cellpadding="1"
    cellspacing="0"
    ItemStyle-CssClass="item"
    HeaderStyle-ForeColor="white"
    HeaderStyle-CssClass="GridHeader"
    HeaderStyle-Height="19"
    AlternatingItemStyle-CssClass="alternating"
    AllowPaging="True"
    OnPageIndexChanged="PageList"
    PagerStyle-Mode="NumericPages"
    PagerStyle-ForeColor="Black"
    PagerStyle-HorizontalAlign="right"
    PagerStyle-CssClass="pager"
    PageSize="10"
    AllowSorting="true"
    OnSortCommand="SortCommand_OnClick"
    AutoGenerateColumns="false"
    DataKeyField="ZoneID">

    <Columns>

    <asp:TemplateColumn HeaderText="">
    <ItemTemplate>
    <asp:CheckBox id="Checkbox" Value="andy" runat="server" />
    </ItemTemplate>
    </asp:TemplateColumn>

    <asp:TemplateColumn HeaderText="">
    <ItemTemplate>
    <asp:Label visible="false" id="ZoneID" runat="server" Text='<%#
    DataBinder.Eval(Container.DataItem, "ZoneID") %>' />
    </ItemTemplate>
    </asp:TemplateColumn>

    <asp:TemplateColumn HeaderText="Zone Name" SortExpression="ZoneName">
    <ItemTemplate>
    <a href="Zone_view.aspx?ZoneID=<%# DataBinder.Eval(Container.DataItem,
    "ZoneID") %>" class="regLink"><%# DataBinder.Eval(Container.DataItem,
    "ZoneName") %></a>
    </ItemTemplate>
    </asp:TemplateColumn>

    <asp:BoundColumn HeaderText="Internal Name" DataField="ZoneInternalName"
    SortExpression="ZoneInternalName"/>
    <asp:BoundColumn HeaderText="Date Created" DataField="DateCreated"
    SortExpression="DateCreated"/>

    </Columns>
    </asp:DataGrid>



    Please let me know if you have seen anything like this before.
     
    Andrzej Wegrzyn, Aug 18, 2003
    #1
    1. Advertisements

  2. Andrzej Wegrzyn

    Frank Wilson Guest

    Could you please post the HTML that is generated? I
    suspect the anchor tag (<a href="Zone_view.aspx?
    ZoneID ...) but I won't know until I can see the HTML.

    Frank
     
    Frank Wilson, Aug 18, 2003
    #2
    1. Advertisements

  3. Did you either just upgrade to Framework 1.1, or did you just start using
    "ZoneList", or has "ZoneList" recently become a container for your <form
    runat="server"> tag?

    This is the infamous "colon in a form name" bug in Framework 1.1. It happens
    whenever you get a server form somewhere inside of a control implementing
    INamingContainer (like "ZoneList"). ASP.NET has always put colons in control
    names to disambiguate them. The bug is that ASP.NET in 1.1 has begun trying
    to use the form name as a variable name. That doesn't work with colons in
    the name...

    There is no good workaround for this. There are several bad ones, and I'm
    sure someone will contribute them.
     
    John Saunders, Aug 18, 2003
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.