ItemTemplate Problem

Jul 6, 2012
Reaction score
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">
<asp:Textbox CssClass="fixdate" Width="100" Runat="server" ID="txtMatchDate" Text='<%# Container.DataItem("MatchDate")%>' ></asp:Textbox>

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


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. After that, you can post your question and our members will help you out.

Ask a Question