Search code examples
c#asp.netservercontrolsasp.net-customcontrol

Apply Visualisation/style to a ASP.NET server control created by injecting JavaScript & HTML


I have created four ASP.NET Server controls that will inject a lot of JavaScript and HTML.

  • One control shows a html table.
  • One control is for showing a data entry form that have juery plugin validation.
  • One control is for creating a data entry form(described above)
  • One control is for modifying that data entered (above).

I want to apply a style the end user can define before the server control is loaded.

Like he/she can say that the HTML table, its tr, its td, have this height or width. He can specify colors, borders, font styles etc.

Before the control is populated he can set all the attributes in the design time.

  1. What is the best way to achieve this?

  2. Do I need to override CSS class properties of server control? if yes, please provide the code.


Solution

  • If you want to do something like that, you would have to write a bunch of code.

    However, you can easily create several different themes and let your user choose a theme before you load the controls. This option would be very easy to do using Themes. Check out this link on Dynamic Themes