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. Advertisements

  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, Apr 3, 2006
    #2
    1. Advertisements

  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
     
    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. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.