Last post Jan 08, 2010 01:00 AM by jkirkerx
Jan 05, 2010 05:36 AM|talsja|LINK
I have created a custom required textbox control. In this control's preinit event i load a css file. Alle css and images are inside the assambly.
When i use my custom control on a page the control loads fine and also the css and images are loaded. Validation of the control occures when i click the validate button.
So this works perfect. But now i want to use my control in the following senario:
I have a grid in an update panel. When i select a record in the datagrid i show a panel in a second updatepanel.
Inside this panel i have my custom required textbox control.
The following is happening:
I select a record and the panel will be made visible. The custom required textbox control is visible, but the build-in css is not loaded.
As a test i have created a new testpage. On this testpage i have put my custom required textboxes in an updatepanel the css is loaded fine.
So when my controls are in a panel inside a updatepanel and i set the panel to visible, the css is not loaded.
Does anybody have a clue?
Thanks in advance
Thanks a lot
Jan 06, 2010 01:10 AM|jkirkerx|LINK
you need to register your css in oninit, in fact, you need to create all of your dynamic objects on oninit.
Embedding css has been kind of unreliable for me. I make propertires now, in which you can assign a class to the object, and program the property to the object
.CssClass = [MicroText]
I need to work on that again later on this year.
Maybe someone else has an anwser
Jan 06, 2010 03:12 AM|talsja|LINK
Thanx for your replay, but i don't see how your suggestion whould help my situation. After some reachers i have found the solution.
I have made a new class :
public class control_designer : System.Web.UI.Design.ControlDesigner
public override string GetDesignTimeHtml()
Assembly l_asm = Assembly.GetExecutingAssembly();
Stream l_css_res = l_asm.GetManifestResourceStream("DutchCreatives.WebControls.UI.Resources.CSS.WebResources.css");
StreamReader l_stream = new StreamReader(l_css_res);
String ls_css = l_stream.ReadToEnd();
return "<style>" + ls_css + "</style>" + base.GetDesignTimeHtml();
And on my Custom Control i have implemented the Control Designer:
public class RequiredTextBox : TextBox, IValidator
Now everything is working just fine.
Jan 08, 2010 01:00 AM|jkirkerx|LINK
I started the post thinking I had an anwser, but realized that I did not.
No help was offered.
Glad to see you figured it out.