edit attribute values of a web control just before control rendered to the page (control's Load even

Discussion in 'ASP .Net Web Controls' started by TJ, Apr 3, 2006.

  1. TJ

    TJ Guest

    I am using a third party web control that doesn't let me access to the
    control's attributes. This is a rookie question, but is there way to
    essentially look at, find/replace a control's attributes just before it gets
    rendered to the page? I thought the control's Load event could be used
    here. Can anyone point me in the right direction?

    ..net 1.0
    C#
    VisualStudio 2003

    p.s. The control is in a TableCell in a DataGrid. I can add to the control
    no problem using the grid's ItemDataBound event, I just grab the control
    (using FindControl) and then use Attributes.Add() to add more stuff. But
    I'm dying to edit an existing attribute's value just before it goes out the
    door.

    p.p.s. Is it possible to read a control's existing attributes during the
    ItemDataBound event in a grid? I have a workaround for the above situation
    if I could do this successfully.

    Thanks in advance,

    TJ
    TJ, Apr 3, 2006
    #1
    1. Advertising

  2. TJ

    TJ Guest

    Found out how to loop through controls attributes, but they don't exist yet
    in the ItemDataBound or ItemCreated event's of the datagrid. That's
    probably why I am unable to see/edit the third pary control's existing
    attributes..they don't exist yet. So I guess again, I just need to now
    when that final collection is available so I can affect change.

    Thanks again in advance.



    "TJ" <> wrote in message
    news:...
    >I am using a third party web control that doesn't let me access to the
    >control's attributes. This is a rookie question, but is there way to
    >essentially look at, find/replace a control's attributes just before it
    >gets rendered to the page? I thought the control's Load event could be
    >used here. Can anyone point me in the right direction?
    >
    > .net 1.0
    > C#
    > VisualStudio 2003
    >
    > p.s. The control is in a TableCell in a DataGrid. I can add to the
    > control no problem using the grid's ItemDataBound event, I just grab the
    > control (using FindControl) and then use Attributes.Add() to add more
    > stuff. But I'm dying to edit an existing attribute's value just before it
    > goes out the door.
    >
    > p.p.s. Is it possible to read a control's existing attributes during the
    > ItemDataBound event in a grid? I have a workaround for the above
    > situation if I could do this successfully.
    >
    > Thanks in advance,
    >
    > TJ
    >
    TJ, Apr 3, 2006
    #2
    1. Advertising

  3. Hi TJ,

    Thank you for posting.

    Regarding on your condition, you want to do some customization on a 3rd
    party developed control before the control being rendered out at runtime.
    Since you're not overwriting the control and just use them in your
    application, I think it is the correct approach that we use events to do
    the customization. And based on my experience, the "PreRender" event of web
    server control is the last event we can do some customization on the
    control before rendering and the modification on the control in Prerender
    will be persisted into ViewState(if that property utilize viewstate):

    #Control.PreRender Event
    http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebuicontrolcl
    assprerendertopic.asp?frame=true

    Hope this helps.

    Regards,

    Steven Cheng
    Microsoft Online Community Support


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    Steven Cheng[MSFT], Apr 4, 2006
    #3
  4. TJ

    TJ Guest

    That's it, that's it. Thanks so much for pointing in the right direction.

    ; )

    -TJ



    "Steven Cheng[MSFT]" <> wrote in message
    news:...
    > Hi TJ,
    >
    > Thank you for posting.
    >
    > Regarding on your condition, you want to do some customization on a 3rd
    > party developed control before the control being rendered out at runtime.
    > Since you're not overwriting the control and just use them in your
    > application, I think it is the correct approach that we use events to do
    > the customization. And based on my experience, the "PreRender" event of
    > web
    > server control is the last event we can do some customization on the
    > control before rendering and the modification on the control in Prerender
    > will be persisted into ViewState(if that property utilize viewstate):
    >
    > #Control.PreRender Event
    > http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebuicontrolcl
    > assprerendertopic.asp?frame=true
    >
    > Hope this helps.
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Community Support
    >
    >
    > ==================================================
    >
    > When responding to posts, please "Reply to Group" via your newsreader so
    > that others may learn and benefit from your issue.
    >
    > ==================================================
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    > rights.
    >
    >
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    TJ, Apr 6, 2006
    #4
  5. You're welcome TJ,

    Have a nice day!

    Regards,

    Steven Cheng
    Microsoft Online Community Support


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    Steven Cheng[MSFT], Apr 7, 2006
    #5
    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. Daniel Walzenbach
    Replies:
    7
    Views:
    600
    Steven Cheng[MSFT]
    Feb 10, 2004
  2. =?Utf-8?B?UG9rZXJKb2tlcg==?=

    Set webcontrol properties before control is rendered?

    =?Utf-8?B?UG9rZXJKb2tlcg==?=, Oct 1, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    410
    Scott Allen
    Oct 2, 2004
  3. Stan Goodman

    Even older fart, even newer newbie

    Stan Goodman, Jul 3, 2003, in forum: Java
    Replies:
    11
    Views:
    676
    Stan Goodman
    Jul 4, 2003
  4. Replies:
    5
    Views:
    356
    david_tm
    Oct 9, 2006
  5. Mike Dee
    Replies:
    3
    Views:
    307
    Mamidipalli
    Mar 1, 2006
Loading...

Share This Page