.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. Advertising

  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

    >-----Original Message-----
    >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.
    >
    >
    >.
    >
    Frank Wilson, Aug 18, 2003
    #2
    1. Advertising

  3. "Andrzej Wegrzyn" <> wrote in message
    news:OL%23$...
    > 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>


    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
    Internet Engineer
    John Saunders, Aug 18, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Schoo
    Replies:
    2
    Views:
    317
    Schoo
    May 10, 2004
  2. John
    Replies:
    0
    Views:
    341
  3. Noozer
    Replies:
    1
    Views:
    367
    brucie
    May 28, 2004
  4. John Salerno

    can't open chm files all of a sudden

    John Salerno, Oct 4, 2006, in forum: Python
    Replies:
    18
    Views:
    1,776
    John Salerno
    Oct 5, 2006
  5. Stephen Miller
    Replies:
    1
    Views:
    484
    Teemu Keiski
    May 18, 2004
Loading...

Share This Page