cannot change value of texbox w/in datagrid after first bind

  • Thread starter Michael Haren via .NET 247
  • Start date
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.
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top