[英]Set default properties for ASP.Net controls
How would I set the default properties of server controls that I'll always use? 如何设置我将始终使用的服务器控件的默认属性? For example I have combos all over my pages which almost always look the same in the mark up text (eg CSS CLasses for PopUp, TextBox, Button, etc.)
例如,我在所有页面上都有组合,这些组合在标记文本中几乎总是看起来相同(例如,用于PopUp,TextBox,Button等的CSS CLasses)。
I thought of putting the control inside an user control and set the properties there. 我想到将控件放入用户控件中并在那里设置属性。 But then I would have to access the control itself with a property of the UC.
但是然后我将不得不使用UC的属性来访问控件本身。
I want to get rid of these repeating tags: 我想摆脱这些重复的标签:
<Appearance>
<AnyRecordFieldCell CssClass="SFGridAnyRecord"></AnyRecordFieldCell>
<AlternateRecordFieldCell CssClass="SFGridAlternateRecord"></AlternateRecordFieldCell>
<RecordPreviewCell CssClass="SFGridRecordPreview" />
<GroupIndentCell CssClass="SFGridGroupIndentCell" />
<GroupCaptionCell CssClass="SFGridGroupCaption" />
<AnySummaryCell CssClass="SFGridAnySummary" />
<GroupCaptionPlusMinusCell CssClass="SFGridPlusMinus" />
<TopLeftHeaderCell CssClass="SFGridTopLeftHeaderCell" />
<RowHeaderCell CssClass="SFGridRowHeaders" />
<ColumnHeaderCell CssClass="SFGridColumnHeaders" />
<GroupHeaderRowHeaderCell CssClass="SFGridGroupedColumnHeaders" />
<FilterBarCell CssClass="SFGridFilterBarCell" />
</Appearance>
Any ideas? 有任何想法吗?
考虑使用ASP.NET主题,您可以使用它们来设置控件的标记。
You could go with a purely CSS solution if these elements are almost always the same - ie have styles for input and button elements. 如果这些元素几乎总是相同的,则可以采用纯CSS解决方案-即具有输入和按钮元素的样式。
Where styles differ the enclosing div, for example, can be referenced to change the style. 在样式不同的地方,例如,可以引用封闭的div来更改样式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.