ItemTemplate Problem

Discussion in 'ASP .Net Datagrid Control' started by CarlS, Jul 7, 2012.

  1. CarlS

    CarlS

    Joined:
    Jul 6, 2012
    Messages:
    1
    I have a simple datagrid that is bound to a filtered dataset. The filter attributes can be selected from a number of dropdown lists on the form, and the form posted back.

    The problem I have is that a bound textbox control in the datagrid does not update when the form is posted, whereas all the other bound columns do.


    <asp:TemplateColumn ItemStyle-Wrap="False" HeaderText="Match Date" ItemStyle-HorizontalAlign="Center">
    <itemtemplate>
    <asp:Textbox CssClass="fixdate" Width="100" Runat="server" ID="txtMatchDate" Text='<%# Container.DataItem("MatchDate")%>' ></asp:Textbox>
    </itemtemplate>
    </asp:TemplateColumn>

    <asp:BoundColumn ReadOnly="True" DataField="MatchDate" HeaderText="Match Date" SortExpression="MatchDate"></asp:BoundColumn>

    The two columns show above both bind to the MatchDate field. The BoundColumn shows show the corrrectly bound data at every postback, whereas the textbox in the TemplateColumn always shows the data from the first time time it is bound.
     
    CarlS, Jul 7, 2012
    #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. Jeremy Chapman

    ItemTemplate help

    Jeremy Chapman, Jul 29, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    538
    Jeremy Chapman
    Jul 29, 2003
  2. Bennett Haselton
    Replies:
    1
    Views:
    5,362
    Joe Fallon
    Sep 24, 2004
  3. Alan Ho

    About ItemTemplate problem

    Alan Ho, Apr 11, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    367
    Teemu Keiski
    Apr 11, 2005
  4. =?Utf-8?B?QnJpYW4=?=

    problem for dropdown list in itemtemplate

    =?Utf-8?B?QnJpYW4=?=, Feb 14, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    492
    =?Utf-8?B?QnJpYW4=?=
    Feb 14, 2006
  5. =?Utf-8?B?T3Bh?=
    Replies:
    3
    Views:
    2,193
    =?Utf-8?B?T3Bh?=
    Nov 1, 2006
Loading...

Share This Page