Archive for the ‘ASP.NET’ Category

Don’t repeat your common CSS between your different themes

To fully understand this article, you need an Asp.Net Themes system knowledge
The case :
You have an application with a CSS layout, and a few themes.
There is just a little change between the different themes, by example you change only the color scheme.
A solution to do that is to repeat all CSS files in all your [...]

More »

How to change the style elements of a listview? (the simple way)

With the ast.net listview control, you can set an AlternatingItemTemplate in order to change the display or what you want.
If you just want to change the backcolor or things like that, you can spare some time by using only the ItemTemplate and applying a diffenrent style depending of the index (use of the Container.DataItemIndex property).
example [...]

More »

How to use a ValidationSummary to display server errors?

Imagine you want to use your ValidationSummary to display server errors as client error, there is a simple way to do that.
First, declare your ValidationSummary, and a CustomValidator with Display property set to “None”

<asp:CustomValidator ID="ServerErrorCustomValidator"
Display="None" runat="server" ValidationGroup="MyValidationGroup" />

<asp:ValidationSummary ID="AdministrationTaskValidationSummary" runat="server" ValidationGroup="MyValidationGroup"/>

Next, in your application code, when an error occurs : set the CustomValidator’s ErrorMessage and [...]

More »