views:

43

answers:

2

I’ve noticed that on aspx page IntelliSense doesn’t display the Style property of a web control, even thought the control does have a Style property. Does that mean we shouldn’t declaratively set the Style property:

<asp:TextBox ID="UserName" Style="color:Green; padding:0px; margin:0px;" runat="server"></asp:TextBox>
+1  A: 

If you have to set these styles in the same file as your html then it's much better to use an embedded style that targets the ID of your control. The best solution, however, is to reference an external stylesheet (css) that contains your styles.

For example:

<style type="text/css">
  #UserName {color:Green; padding:0px; margin:0px;}
</style>
Chris Arnold
I realize there are better options, I was just being curious whether it is allowed to set it declaratively
carewithl
+1  A: 

Hey,

Style translates to the client-side style property; it's actually a CssStyleCollection collection of styles. It doesn't display the style property directly, but once you type style=" it should start showing you the CSS styles that are available to you.

Brian
"but once you type style=" it should start showing you the CSS styles that are available to you." It does, but I was a bit suspicious since IntelliSense didn't show it. Anyways, thank you both for your help
carewithl
Oh really? I do get intellisense, so it may be a different problem...
Brian