M
Michael Haren via .NET 247
I have a datagrid with the columns defined in the aspx
<columns>
<asp:TemplateColumn HeaderText="Hours" ItemStyle-Width="1%"ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox Columns="2" EnableViewState="False" ID="Hours"Runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
...
</columns>
I have other bound columns that display the correct data so Iknow the dataset is ok.
Here's the problem. In
Code:
dgTest_ItemBound(...) Handles dgTest.ItemDataBound
I have:
Code:
CType(e.Item.Cells(3).FindControl("Hours"), TextBox).Text =drv("TotalHours").ToString
When I make the first request, the hours txtbox is populatedcorrectly. Any rebinding after that, the value is unchanged. Ifthe box initially was filled with '20' and the grid was reboundto contain 0 hours, 20 remains, even though another bound columncontaining 'TotalHours' DOES change. This is very strange. Anyideas?
I've already tried things with viewstate on/off for the dg andtxtbox. I've already tried adding the textbox controldynamically and clearing it, etc. No good.
I also tried using
Code:
<asp:textbox><%# eval....container... %></asp:textbox>
but you can't do that for other reasons.
This isn't the usual batabinding on page_load so you can't getthe selected values or entered values--it's the other wayaround.
Any help if appreciated. Thank you.
<columns>
<asp:TemplateColumn HeaderText="Hours" ItemStyle-Width="1%"ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox Columns="2" EnableViewState="False" ID="Hours"Runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
...
</columns>
I have other bound columns that display the correct data so Iknow the dataset is ok.
Here's the problem. In
Code:
dgTest_ItemBound(...) Handles dgTest.ItemDataBound
I have:
Code:
CType(e.Item.Cells(3).FindControl("Hours"), TextBox).Text =drv("TotalHours").ToString
When I make the first request, the hours txtbox is populatedcorrectly. Any rebinding after that, the value is unchanged. Ifthe box initially was filled with '20' and the grid was reboundto contain 0 hours, 20 remains, even though another bound columncontaining 'TotalHours' DOES change. This is very strange. Anyideas?
I've already tried things with viewstate on/off for the dg andtxtbox. I've already tried adding the textbox controldynamically and clearing it, etc. No good.
I also tried using
Code:
<asp:textbox><%# eval....container... %></asp:textbox>
but you can't do that for other reasons.
This isn't the usual batabinding on page_load so you can't getthe selected values or entered values--it's the other wayaround.
Any help if appreciated. Thank you.