AJAX Bug? Using UpdatePanels inside a FormView Control - Insert/Edit Modes - Getting a "txtDate is already declared as txtDate" Message

Last post 05-09-2008 1:31 PM by synapse88. 5 replies.

Sort Posts:

  • AJAX Bug? Using UpdatePanels inside a FormView Control - Insert/Edit Modes - Getting a "txtDate is already declared as txtDate" Message

    05-08-2008, 2:10 PM
    • Loading...
    • synapse88
    • Joined on 12-31-2007, 5:01 PM
    • Posts 5

    So I had a working Formview page, with Edit and Insert modes, each with identical controls (text, labels etc). I decided I wanted to use an Update Panel to update a Text Box with today's date based on the selection of a drop down.

    Normally with a FormView I can normally have the same Text Box in both the Edit Template and the Insert Template, with the same ID name (txtDate) and everything with no problem....which is helpful/needed for databinding and code-behind methods.

    But now when I place controls inside the 2 update panel in both Edit and Insert Templates, I get a "txtDate is already declared as txtDate" message for each control which is a contained in both (Insert Template, Edit Template)  update panels.

     

    Is this a bug?  A couple people over at Experts Exchange seem to think so

    Is there a viable workaround for this? I tried changing the name of one of the txtDate controls (and ALL refrences to it), but the databinding doesn't work when I do that (since after making the change I have two different controls bound to the same data element.)

  • Re: AJAX Bug? Using UpdatePanels inside a FormView Control - Insert/Edit Modes - Getting a "txtDate is already declared as txtDate" Message

    05-09-2008, 8:15 AM
    • Loading...
    • synapse88
    • Joined on 12-31-2007, 5:01 PM
    • Posts 5

     anybody?

  • Re: AJAX Bug? Using UpdatePanels inside a FormView Control - Insert/Edit Modes - Getting a "txtDate is already declared as txtDate" Message

    05-09-2008, 9:02 AM

    Have you tried placing the FormView within the UpdatePanel and setting the UpdatePanel to conditional mode? You can then define the triggers for the UpdatePanel. You may have to disable view state for the FormView as well...

    Secondly, you could always just use static page methods and invoke the method from client-side JS using the AJAX framework.

    Matthew Ellis
    ASP.NET 3.5 AJAX Pocket Guide
    Amazon.com || MI
  • Re: AJAX Bug? Using UpdatePanels inside a FormView Control - Insert/Edit Modes - Getting a "txtDate is already declared as txtDate" Message

    05-09-2008, 9:21 AM
    • Loading...
    • synapse88
    • Joined on 12-31-2007, 5:01 PM
    • Posts 5

    Matthew Ellis:

    Have you tried placing the FormView within the UpdatePanel and setting the UpdatePanel to conditional mode? You can then define the triggers for the UpdatePanel. You may have to disable view state for the FormView as well...

    Secondly, you could always just use static page methods and invoke the method from client-side JS using the AJAX framework.

     

    So place the ENTIRE formview control inside a single update panel?  like this?

      

    1    <updatepanel>
    2    <contenttemplate>
    3    
    4    
    5    <formview>
    6    
    7    <edititemtemplate>
    8    </edititemtemplate>
    9    
    10   <insertitemtemplate>
    11   </insertitemtemplate>
    12   
    13   </formview>
    14   
    15   
    16   </contenttemplate>
    17   <triggers>
    18   </triggers>
    19   </updatepanel>
    
     
  • Re: AJAX Bug? Using UpdatePanels inside a FormView Control - Insert/Edit Modes - Getting a "txtDate is already declared as txtDate" Message

    05-09-2008, 11:11 AM
    • Loading...
    • frankzhang
    • Joined on 05-09-2008, 3:07 PM
    • Posts 1

    Just found a way. it works but not sure whether it is properly way.

    you can add the same ID control outside the forview and make it invisible

  • Re: AJAX Bug? Using UpdatePanels inside a FormView Control - Insert/Edit Modes - Getting a "txtDate is already declared as txtDate" Message

    05-09-2008, 1:31 PM
    • Loading...
    • synapse88
    • Joined on 12-31-2007, 5:01 PM
    • Posts 5

     

    frankzhang:

    Just found a way. it works but not sure whether it is properly way.

    you can add the same ID control outside the forview and make it invisible

     Hi, I appreciate the response, but I'm not sure I understand what you mean.  If I just add another textbox for txtDate, I still get the message since now THREE exist (one in edittemplate, on in inserttemplate, one outside formview)

Page 1 of 1 (6 items)