Validator in Footer Causing Javascript Error (with ShowFooter)

Discussion in 'ASP .Net' started by Chris S, Apr 6, 2006.

  1. Chris S

    Chris S Guest

    I am going crazy trying to figure this out, and I am wondering if this is a
    bug in the ASP.Net 1.1 implementation.

    My situation:

    I have an ASPX page with 2 different modes:

    *Mode 1: Datagrid with no footer
    *Mode 2: Datagrid with a footer template containing a textbox and an "Add
    Record" command (also has an edit column)

    Everything works fine until I put a RequiredFieldValidator in the
    FooterTemplate. Doing so causes the following Javascript error:
    'Page_Validators' is undefined. I believe this is happening because I am
    dynamically showing / hiding the footer in my code-behind, depending on a
    selected dropdown value within the page.

    Is there a workaround / solution for this?

    Footer Template snippet:

    <FooterTemplate>
    <asp:LinkButton CommandName="AddNewRecord" Text="Add Custom Threshold"
    ID="lnkAddThreshold" Runat="server"/>
    <asp:RequiredFieldValidator ID="reqDdThresholdUpperAddNew"
    ControlToValidate="txtDdThresholdUpperAddNew" ErrorMessage="Please enter a
    value" Display="Dynamic" Visible="True" Runat="server"/>
    </FooterTemplate>

    Code Behind snippet:

    protected void BindGrid()
    {
    //Set each grid's datasource and bind to it
    dgDDThresholdData.DataSource=DataAccess.clsCommonAccess.getDBValues();
    dgDDThresholdData.DataBind();

    //If we are showing a custom version of the form, then allow
    editing/adding/deleting of values
    if(Convert.ToInt32(intThresholdTypeID)==2)
    {
    dgDDThresholdData.Columns[6].Visible=true; //show the edit column
    dgDDThresholdData.Columns[7].Visible=true; //show the delete column
    dgDDThresholdData.ShowFooter = true; //show the footer (add new
    record)
    }
    else
    {
    dgDDThresholdData.Columns[6].Visible=false; //hide the edit column
    dgDDThresholdData.Columns[7].Visible=false; //hide the delete column
    dgDDThresholdData.ShowFooter = false; //hide the footer (add new
    record)
    }
    }


    Any ideas?
     
    Chris S, Apr 6, 2006
    #1
    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. Utter Newbie
    Replies:
    3
    Views:
    3,810
    Utter Newbie
    Oct 5, 2004
  2. Nick C

    Showfooter not working?

    Nick C, Feb 2, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    522
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
    Feb 2, 2007
  3. Bren Besser

    Where to set "ShowFooter" attribute

    Bren Besser, Jun 23, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    113
    Bren Besser
    Jun 25, 2005
  4. Henrik
    Replies:
    1
    Views:
    466
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
  5. Jon Turner

    DataGrid ShowFooter Routine

    Jon Turner, Oct 10, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    143
    Jon Turner
    Oct 10, 2003
Loading...

Share This Page