onTextChanged not firing

Discussion in 'ASP .Net' started by kbrandl@gmail.com, Feb 1, 2005.

  1. Guest

    On my page, there is a textbox at the top that contains a date -- and a
    fully-editable datagrid below (each row in the datagrid contains an
    editable textbox, along with some other controls).

    The date textbox is defined as:

    <asp:TextBox EnableViewState="True" ID="HoursWorkedDate_TextBox"
    Runat="server" width="80px" CssClass="inputstyle"
    onBlur='javascript:Search.submit();' OnTextChanged="Date_Changed" />

    When the date is changed, and the textbox loses focus (onBlur), the
    page is submitted, causing the OnTextChanged event to fire and the
    server-side "Date_Changed" method to execute. This is working
    correctly.

    Each textbox within the fully-editable datagrid is defined as follows:

    <asp:TextBox Width="40px" CssClass="inputstyle" MaxLength="4"
    ID="HoursWorked_TextBox" Runat="server" Value='<%#
    DataBinder.Eval(Container.DataItem, "UpdateHoursWorked")%>'
    OnTextChanged="DG_RowChanged" />

    I would expect that if I change data within the textboxes of the
    editable datagrid, and the page is submitted, the OnTextChanged event
    would fire for any changed rows. This works fine if I submit the page
    by clicking the submit button...but not if the page submits by the Date
    textbox at the top of the page being changed.

    If I change the data within the data grid, then change the date at the
    top of the page and hit ENTER, the page refreshes -- but only the
    OnTextChanged event associated with the Date textbox fires...the
    OnTextChanged events associated with the datagrid textboxes do NOT
    fire. What am I doing wrong here???
    , Feb 1, 2005
    #1
    1. Advertising

  2. Hi kbrandl
    Change the property of textbox
    AutoPostBack to true
    this will work



    "" wrote:

    > On my page, there is a textbox at the top that contains a date -- and a
    > fully-editable datagrid below (each row in the datagrid contains an
    > editable textbox, along with some other controls).
    >
    > The date textbox is defined as:
    >
    > <asp:TextBox EnableViewState="True" ID="HoursWorkedDate_TextBox"
    > Runat="server" width="80px" CssClass="inputstyle"
    > onBlur='javascript:Search.submit();' OnTextChanged="Date_Changed" />
    >
    > When the date is changed, and the textbox loses focus (onBlur), the
    > page is submitted, causing the OnTextChanged event to fire and the
    > server-side "Date_Changed" method to execute. This is working
    > correctly.
    >
    > Each textbox within the fully-editable datagrid is defined as follows:
    >
    > <asp:TextBox Width="40px" CssClass="inputstyle" MaxLength="4"
    > ID="HoursWorked_TextBox" Runat="server" Value='<%#
    > DataBinder.Eval(Container.DataItem, "UpdateHoursWorked")%>'
    > OnTextChanged="DG_RowChanged" />
    >
    > I would expect that if I change data within the textboxes of the
    > editable datagrid, and the page is submitted, the OnTextChanged event
    > would fire for any changed rows. This works fine if I submit the page
    > by clicking the submit button...but not if the page submits by the Date
    > textbox at the top of the page being changed.
    >
    > If I change the data within the data grid, then change the date at the
    > top of the page and hit ENTER, the page refreshes -- but only the
    > OnTextChanged event associated with the Date textbox fires...the
    > OnTextChanged events associated with the datagrid textboxes do NOT
    > fire. What am I doing wrong here???
    >
    >
    =?Utf-8?B?c2FyYQ==?=, Feb 2, 2005
    #2
    1. Advertising

  3. Guest

    I've already tried that...when I set AutoPostBack=True for the 'Date'
    textbox at the top, the form correctly posts when the text is
    changed...but still the OnTextChanged events don't fire for any of the
    modified textboxes within the datagrid below. Although setting
    AutoPostback=True for the textboxes within the datagrid does work --
    there's a big issue with this -- it prevents the user from simply
    tabbing though the input textboxes in the grid -- since when they enter
    text and tab, the page submits, causing the page to receive focus
    again, instead of the next input element. Any other ideas?
    , Feb 2, 2005
    #3
  4. Try to write ur code in apsx.vb or aspx.cs
    may be it work

    "" wrote:

    > I've already tried that...when I set AutoPostBack=True for the 'Date'
    > textbox at the top, the form correctly posts when the text is
    > changed...but still the OnTextChanged events don't fire for any of the
    > modified textboxes within the datagrid below. Although setting
    > AutoPostback=True for the textboxes within the datagrid does work --
    > there's a big issue with this -- it prevents the user from simply
    > tabbing though the input textboxes in the grid -- since when they enter
    > text and tab, the page submits, causing the page to receive focus
    > again, instead of the next input element. Any other ideas?
    >
    >
    =?Utf-8?B?c2FyYQ==?=, Feb 2, 2005
    #4
    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. Henri
    Replies:
    6
    Views:
    742
    Henri
    Aug 6, 2004
  2. =?Utf-8?B?TmVpbA==?=

    OnTextChanged not firing??

    =?Utf-8?B?TmVpbA==?=, Oct 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    4,251
    =?Utf-8?B?TWFyeUE=?=
    Aug 29, 2005
  3. mdipiet
    Replies:
    1
    Views:
    1,192
  4. Eidolon

    OnTextChanged in datagrid not working

    Eidolon, May 19, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    123
    Vidar Petursson
    May 20, 2004
  5. kj

    OnTextChanged not working

    kj, May 15, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    617
    Peter
    May 16, 2007
Loading...

Share This Page