custom-server-controls

How to relate controls and loop through the values

I have server controls that I am dynamically adding to a page and assigning a unique ID based on the index such as control.id = "mytextbox" + i What I am trying to do is have a related control for example each textbox would also have a related dropdown menu so users can enter a request in the textbox and select a quantity in the dro...

ASP.Net: Modifying HTML output of DataPager control

Hi, On validating my site with W3C, I noticed that the DataPager control was rendering a inside a , which is invalid HTML. I want to create a custom server control which derives from the DataPager control. To do this, I believe I will have to modify the RenderControl function. My question is, will I have to recreate the entire Rend...

Explosif TemplateField

Hi, I have a custom server control that implement templatefield (textbox), what I want to do is when textchanged call enchurechangeevent () ? ...

Connecting to database in ASP.NET server control

As a follow on from this question I'm building a custom server control to be placed on a Sharepoint 2010 master page. The idea behind this is that it will display a menu that is dynamically populated from the database. As this is a server control, I'm building it in a dll but I've run into a small snag. As it has to connect to the data...

Date validating Textbox server control

I'm trying to create a custom server control that is just a textbox with an AJAX asp.net MASKEDEDITEXTENDER to valid the control when it loses focus to ensure that a proper date has been entered. This is all I have so far and I'm able to build the control but no validation is taking place what am I doing wrong here. namespace One_Eva...

I receive error 'Unknown Server Tag' with Page.ParseControl on a custom server control, not asp control ?

I'm building a dynamic form using XML and XSLT. Anyway I'm using a custom asp.net control for CKEditor, it's an HTML editor. When I try to add the controls from the XSLT using Page.ParseControl(<the-string-from-the-xslt-here>), I get a warning saying: Unknown server tag 'FCKeditor.CKEditor' And of course, if I remove the control f...

How can I create a custom web server control for a gridview in asp.net

Visual Studio 2008 .Net 3.5 C# I have a web site that has a lot of pages with grid views. I want to be able to add an "Export to Excel" button on some of the grid views, so I started looking and found Custom Web Server Controls - see this page for an example. This example of a custom label lets you pass in string parameters as inpu...

How can I replicate If...Then logic as a Web control?

I have a designer working at the ASPX level. He doesn't do C#, doesn't do code-behinds, doesn't compile, etc. He's a pure designer, working with HTML and server controls. I need a conditional control -- an If...Then-ish type thing. Normally, I would do this: <asp:Placeholder Visible='<%# DateTime.Now.Day == 1 %>' runat="server"> I...

ASP.NET Custom Templated Control - Is there a way to modify where databound data is output to?

Basically, I have a custom templated control with a custom data container class. When a developer adds an instance of my control to a page, they can define the controls in the LayoutTemplate however they like, as follows: <ml:MyControl id="MyControl1" runat="server"> <LayoutTemplate> <span><%#Container.ErrorMessa...

Can Customcontrol event can be overriddden?

I have a gridview customcontrol, for that paging event has defined in seperate class library. Can i write an paging event in my aspx.cs where i am using the customcontrol instead of calling that event from seperate class file ...

C# Composite Server Control Datapager not working

I am building a composite server control that includes a listview & a datapager. When I view the page, the listview renders correctly but the datapager is empty. When I step through the code, it shows total rows of the datapager to be 0 although the item count in the listview I have created (and attached to the datapager) is 12. Anyho...

Design time validation of custom ASP.NET server controls

I am creating a custom control which has some properties on it. The problem is that the control isn't valid without those properties being set and there aren't suitable default values for them. How can I make sure that they are being set in the ASP.NET markup when being included on the page? Is there some kind of validation event that c...

What is the best way to databind a listbox inside a custom control

I have a simple custom control that boils down to a label and a listbox. Selections in the listbox are reflected in the label as comma separated values. My question is what is the best and simplest way to make the page developers experience of working with the custom control exactly mimic the experience of working with just the listbox...

How to put asp.net custom control definitions in separate file?

If one has a lot of custom controls the list of elements withing the element gets quiet long making the web.config tedious to work with. Does anyone know a better/different way of defining custom controls (maybe put them in a separate file like it's possible for appSettings. Thanks. ...

ASP.NET Custom Control - What is the best way to include embedded CSS reference only once?

The problem: I am embedding a CSS file into a custom control library with several controls. I want to share the same CSS file for all of the controls regardless of how many instances of them are on a given form. When more than one control is on the form, I would like exactly 1 reference to the CSS file in the HTML header of the ASP.NET p...

What issues surround the security of a custom server control?

I'm writing some db access server controls at the moment that take properties for things like data source and column required and whatnot. In my head I have thought about this approach and it seems to me that, in order to make these controls work you have to put them on the page and fill them full of explicit references to the database ...

Can I retrieve the value of a standard input in ASP.NET?

I've created a custom server control in ASP.NET to render a standard checkbox and a hidden field like this: public class CheckAllBox : WebControl { private string checkboxClientID; protected override void OnInit(EventArgs e) { checkboxClientID = String.Format("{0}{1}chbCheckAll", base.ClientID, base.ClientIDSeparat...

ASP.NET Server Controls that mimic standard control functionality - painted into a corner?

We are using a bunch of server controls of every flavor that mimic all the standard controls and then some (all the way down to a control that emits Header HTML tags and horizontal lines). Deep down, they inherit from WebControl but fully render the HTML, rather than inheriting from Textbox, etc. They do not use Control Adapters and hand...

ASP.NET Server Control - Is shared Viewstate between controls possible

If I have a master 'composite custom server control', with several child custom controls, is it possible, for the master control to share its viewstate with the child controls, which are also custom composite server controls,(all of the controls are composite custom server controls)? To expand a little more, say I have a Person control...