开发者

fixed layout in formview template

I have n pages with formviews, all sharing a s开发者_开发百科imilar layout inside their item/edit/insert templates.

For example all item and edit templates have a header and body part inside where i put the fields. The header has a certain style and the body part too.

My question is how can i enforce this style in all my formviews without repeating the same bulk css styles all the time.

Now i'm using masterpages for this with multiple formviews on 1 page. That's not good i think. I want one 1 page for edit/insert/item and 1 formview.

I would prefer somehow to define the style for edit template once and load it into every formview. Ofcourse not all the formviews have the same fields, so like masterpages i would like to have 'areas' where i can put my fields.

The perfect way i suppose would be to have a formview span a complete masterpage based page including the contentplaceholders inside it's edit/insert/item templates.

Any ideas are more than welcome.

Edit: I read it's possible in .Net 4 using dynamic data. I'm stuck with 3.5 for the moment.


You could set a CSSClass for the form view or some other standard container than use child selectors in your CSS.


You can use Themes(or Style Sheet Themes) and skins for this. For Example Create a theme Theme1 and a skin file under it with the following content.

<asp:FormView  runat="server" 
      RowStyle-BackColor="Blue" />

Now you can make pages in your application use the theme by entering the following in web.config.

 <pages theme="Theme1">

Also you can use RowStyle-CSSClass or EditRowStyle(to apply to edit template). You can also enter the style sheet file in the same Theme folder

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜