Get controls values upon auto-postback of another control inside DataGrid

Discussion in 'ASP .Net Datagrid Control' started by postings@alexshirley.com, Apr 29, 2005.

  1. Guest

    Hi

    This is edited from post from a while back, there's still something I
    need to find an answer for (boy datagrids are a headache when you first
    start out doing something out of the norm eh :).

    Could anybody help please? Here we go then....

    In my datagrid I have a few textbox controls in an EditItemTemplate
    like so:

    ----------------------------------------
    <asp:TextBox id=txtPrice ontextchanged="txtPrice_TextCh­anged"
    runat="server" AutoPostBack="True">
    <asp:TextBox id=txtDiscount runat="server" %>'>
    <asp:TextBox id=txtTotal runat="server" %>'>
    ----------------------------------------

    I also have back end code like this:

    ----------------------------------------
    Sub txtPrice_TextChanged(ByVal sender As System.Object, ByVal e As
    System.EventArgs)

    Dim txtPrice As TextBox = CType(sender, TextBox) 'Thanks to Scott
    Mitchell for this

    Dim txtDiscount As TextBox = 'Where do I get this control value?
    Dim txtTotal As TextBox = 'Where do I get this control value?

    End Sub
    ----------------------------------------

    As you can see the subroutine is trigger by the ontextchanged of
    txtPrice

    I now need to get the values of a textbox inside the datagrid
    (txtDiscount), and update the value of another textbox inside the
    datagrid (txtTotal), from this same subroutine which is triggered by
    autopostback (unless there is another way).

    How can I get the values of these other controls from the datagrid?

    (I can't use
    MyDataGrid.Items(e.Item.ItemIndex).FindControl("txtDiscount") and
    "sender" only passes over values from txtPrice and no other controls.
    I'm stumped!).

    Many thanks....!

    Alex
     
    , Apr 29, 2005
    #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. nail
    Replies:
    0
    Views:
    1,563
  2. Psych971
    Replies:
    5
    Views:
    4,651
    bruce barker
    Dec 17, 2004
  3. Jacky Chau
    Replies:
    2
    Views:
    2,087
    Ninjamyst
    Jun 8, 2005
  4. linkswanted
    Replies:
    1
    Views:
    948
  5. debartsa
    Replies:
    1
    Views:
    264
    John Saunders
    Apr 23, 2004
Loading...

Share This Page