FindControl Method no longer working...

Discussion in 'ASP .Net' started by Karen, May 11, 2004.

  1. Karen

    Karen Guest

    Hi,

    We have a datagrid with a templated column. This column contains a
    textbox. Up until yestday this code (below) worked fine.

    str_note =
    CType(DetailsGrid.Items(mintRowsLoop).FindControl("txtNote"),
    TextBox).Text()

    If mintRowsLoop = 0 (first row in datagrid) the above code doesn't
    return the text that was entered.

    I've rebuilt the column an still doesn't work.

    The debugger shows the text property of = ""....argh...

    Any suggestions or ideas?

    Thanks,
    Karen
    Karen, May 11, 2004
    #1
    1. Advertising

  2. Karen wrote:
    > We have a datagrid with a templated column. This column contains a
    > textbox. Up until yestday this code (below) worked fine.
    >
    > str_note =
    > CType(DetailsGrid.Items(mintRowsLoop).FindControl("txtNote"),
    > TextBox).Text()
    >
    > If mintRowsLoop = 0 (first row in datagrid) the above code doesn't
    > return the text that was entered.


    Karen, FindControl is working, I assure you, otherwise you'd get an
    error when trying to reference the Text property.

    Are you sure you are not binding the DataGrid on EVERY page load, but
    only on the FIST page load? Assuming you are reading the value after,
    say, the Update button was clicked, it is common to have the values
    "reset" if you are blindly rebinding on each page load. For more info, see:
    http://datawebcontrols.com/faqs/Editing/EditedValuesNotSaved.shtml

    --

    Scott Mitchell

    http://www.4GuysFromRolla.com
    http://www.ASPFAQs.com
    http://www.ASPMessageboard.com

    * When you think ASP, think 4GuysFromRolla.com!
    Scott Mitchell [MVP], May 11, 2004
    #2
    1. Advertising

  3. Karen

    Karen Guest

    Thanks Scott,

    Appears someone alterd the page load event yesterday...lol.

    Karen

    On Tue, 11 May 2004 18:05:03 GMT, "Scott Mitchell [MVP]"
    <> wrote:

    >Karen wrote:
    >> We have a datagrid with a templated column. This column contains a
    >> textbox. Up until yestday this code (below) worked fine.
    >>
    >> str_note =
    >> CType(DetailsGrid.Items(mintRowsLoop).FindControl("txtNote"),
    >> TextBox).Text()
    >>
    >> If mintRowsLoop = 0 (first row in datagrid) the above code doesn't
    >> return the text that was entered.

    >
    >Karen, FindControl is working, I assure you, otherwise you'd get an
    >error when trying to reference the Text property.
    >
    >Are you sure you are not binding the DataGrid on EVERY page load, but
    >only on the FIST page load? Assuming you are reading the value after,
    >say, the Update button was clicked, it is common to have the values
    >"reset" if you are blindly rebinding on each page load. For more info, see:
    >http://datawebcontrols.com/faqs/Editing/EditedValuesNotSaved.shtml
    Karen, May 11, 2004
    #3
    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. GO
    Replies:
    4
    Views:
    503
  2. Lew Burrus
    Replies:
    3
    Views:
    303
    =?Utf-8?B?Q3Jpcw==?=
    Sep 30, 2004
  3. =?Utf-8?B?TWlrZQ==?=

    Rowfilter no longer working

    =?Utf-8?B?TWlrZQ==?=, Nov 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    307
    =?Utf-8?B?RGVlcGFr?=
    Nov 24, 2004
  4. Mark B
    Replies:
    8
    Views:
    1,829
    Mark B
    Jul 28, 2005
  5. =?Utf-8?B?a25m?=
    Replies:
    5
    Views:
    357
    =?Utf-8?B?a25m?=
    May 10, 2007
Loading...

Share This Page