|
-
Oct 21st, 2007, 08:43 AM
#1
Thread Starter
Hyperactive Member
[2005] Styles and Custom Controls
Hi,
I´m reading a book on custom controls, "Wrox ASP.Net 2.0 Server Control Development",..
And have come accross something I do not fully understand,..
If you override the CreateControlStyle method so you return a TableSyle, why is there a need to pass the viewstate of the control to the style object.
http://msdn2.microsoft.com/en-us/lib...le(VS.80).aspx
Code:
protected override Style CreateControlStyle()
{
return new TableStyle(ViewState);
}
The thing is further on in the chapter it creates its own customStyleTable Object, so it includes certain properties which the TableStyle doesn´t include,..
Well not going into too much detail, but it stores it´s values in viewstate.
Which confuses me, so does viewstate also store style values?
The source code, displays all the attributes assigned to the control,
for instance:
HTML Code:
<div>
<table id="rauland" style="background-color:#FFC0C0;">
<tr>
<td>Hello people</td>
</tr>
</table>
</div>
Background-color, appears as is in the table. So why is there a need to make the controls viewstate available to the style object?
THanks,
Rauland
-
Oct 21st, 2007, 01:15 PM
#2
Re: [2005] Styles and Custom Controls
I suppose it'd be because this method could be applied to more complex controls which have other properties and styles. Viewstates could hold styles, but it'd also hold other properties associated with all of the controls on the page. Hence the need for passing the viewstate.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|