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

Discussion in 'ASP .Net Datagrid Control' started by Michael Haren via .NET 247, Sep 8, 2004.

  1. 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.
    --------------------------------
    From: Michael Haren

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>btl07vWhK0WGyyhJVlVpTA==</Id>
     
    Michael Haren via .NET 247, Sep 8, 2004
    #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. Gandalf
    Replies:
    12
    Views:
    574
    Gandalf
    Aug 1, 2003
  2. Rob T

    Hidden Texbox

    Rob T, Jun 10, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    10,588
    Sharon Tal
    Jun 10, 2004
  3. David

    width of texbox in editItem

    David, Jan 25, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    376
    David
    Jan 25, 2005
  4. Yog
    Replies:
    0
    Views:
    1,616
  5. Replies:
    0
    Views:
    123
Loading...

Share This Page