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


T

TJ

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
 
Ad

Advertisements

T

TJ

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

Steven Cheng[MSFT]

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.)
 
Ad

Advertisements

S

Steven Cheng[MSFT]

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

Top