Finding Grid controls

Discussion in 'ASP .Net' started by Rick Spiewak, Jul 24, 2003.

  1. Rick Spiewak

    Rick Spiewak Guest

    I have been unable to find an elegant way to navigate to the controls in a
    DataGrid in edit mode in order to get the changed values. I end up with a
    lot of code like:

    e.Item.Controls(5).Controls(0)

    to get at a simple textbox, or:

    e.Item.Controls(5).Controls(1)

    if there is a multiline text box.

    No ID's seem to end up on these controls, and I can't seem to find a
    generalizable, clean way to access them. Any ideas?

    Regards - Rick
     
    Rick Spiewak, Jul 24, 2003
    #1
    1. Advertising

  2. Rick Spiewak

    Guest Guest

    I don't know if this is OK for you but I sometimes use template columns,
    then I name the controls in design mode, and access them this way :

    Dim txt as Textbox
    txt=ctype(e.Item.fincontrols("txtName"), Textbox)

    "Rick Spiewak" <> wrote in message
    news:...
    > I have been unable to find an elegant way to navigate to the controls in a
    > DataGrid in edit mode in order to get the changed values. I end up with a
    > lot of code like:
    >
    > e.Item.Controls(5).Controls(0)
    >
    > to get at a simple textbox, or:
    >
    > e.Item.Controls(5).Controls(1)
    >
    > if there is a multiline text box.
    >
    > No ID's seem to end up on these controls, and I can't seem to find a
    > generalizable, clean way to access them. Any ideas?
    >
    > Regards - Rick
    >
    >
     
    Guest, Jul 25, 2003
    #2
    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. Girish
    Replies:
    4
    Views:
    673
    Patrick.O.Ige
    Jul 19, 2005
  2. =?Utf-8?B?QXNzYW5LaGFuIElzbWFpbA==?=

    How to transfer a value from an Invisible Grid to an visible Grid

    =?Utf-8?B?QXNzYW5LaGFuIElzbWFpbA==?=, Oct 13, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    473
    =?Utf-8?B?QXNzYW5LaGFuIElzbWFpbA==?=
    Oct 17, 2005
  3. Danny Tuppeny

    Grouped grid? Or grid within datalist?

    Danny Tuppeny, Oct 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    503
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Oct 27, 2005
  4. Marc
    Replies:
    0
    Views:
    454
  5. Simon L
    Replies:
    3
    Views:
    407
    Jeff Flinn
    Mar 31, 2006
Loading...

Share This Page