custom-server-controls

Passing page's server controls as parameter in custom user control

Hi , I want to pass the page's server controls(especially gridviews,datalists,repeaters) as parameter to my custom server control. My purpose is to make a html to pdf export button as a custom server control.Programmer will add the my custom control to a page and select the control from the usercontrol properties which he/she wants to ma...

Is it safe to invoke MemberwiseClone() on custom server controls?

Hi, I have written a custom server control which (pseudo-code) looks like public class MyCustomCtrl : WebControl { private Button innerCtrl; //some arbitrary object, doesn't matter ... protected override void CreateChildControls() { //initialization etc, as standard... } } Now I have the case that I have to c...

Custom server control, with form and scriptmanager

I am building a set of asp.net server controls and in one of them, essentially a container control, I want to add a form control, a script manager and an update panel. Is this possible or will I have to create these in a Page base class that I have for the web project for page/control life cycle reasons? I am not using master pages. Re...

single template server control

Is it possible to have a custom server control with a single template (meaning the user can put any text they want) without having to require the an "ItemTemplate" like in a FormView control? I would want the control in Source View to look like this <foo:mycontrol runat="server" id="controlid"> User puts whatever html content they wa...

How do I get ASP.NET to recognize my custom server control?

I am trying to create my first ASP.net server control derived from a Panel. For some reason, I am unable to get the .aspx page to recognize my server tag even though the application recognizes the class and namespace of my control. Here are the steps I've used: 1) I created a class CollapsablePanel that I've placed in my site_code dir...

What is the proper way to extend <asp:Panel>?

I am attempting to create a custom server control "CollapsablePanel" that extends ASP.net's Panel. Essentially what I'm trying to do is take the current Panel, add a title bar and any necessary javascript to add the collapse/expand functionality. Other than that I want the .aspx syntax and general panel functionality to remain the same...

How do I embed javascript directly into my ASP.net Custom Control?

I am building my first user control and I would like to package the javascript required for the control with the assembly so the end user does not have to worry about including dependencies. I've followed a tutorial from Scott Mitchell (http://aspnet.4guysfromrolla.com/articles/080906-1.aspx) but I can't seem to get it to work right. H...

How do I add a reference to a server control in my current website to the web.config

I have extended a server control (not a user control) and put the code in my app_code folder. I would like to add a tag prefix to the web config, but <add tagPrefix="cc1" namespace="mynamespace" /> and <add tagPrefix="cc1" namespace="mynamespace" assembly="currentwebsitename" /> don't work. I get this error: Error 147 Unknown s...

How do I access Page controls from within my custom server control?

I am building a modal box as a custom server control and I want to have a property on the modal box TargetControlID that specifies the element that will show the modal when clicked. I've set the property up in the modal box and in the code behind I use the following code block (which I've tried in several different places If (_targ...

Should custom server control access data or be fully bound from client?

The question is whether it's better to encapsulate general data code within a server control or bind the data to the control from the client? The control will be utilized by various different applications and the data is generally only for the control. So the question is, rather than duplicate the code to bind the control in every clie...

Creating my own Web Server Hyperlink control - problems overriding the class attribute

I'm in the process of writing some web server controls to make working with basic jQuery UI themed controls and widgets easier. All I need to do at this stage is add some additional CSS classes into hyperlinks. The code below is my web server control. using System; using System.ComponentModel; using System.Security.Permissions; using S...

How can i create a ModalPopupExtender control dynamically from a server control?

I have a composite server control that does quiet a number of things; one of which is to display a ModalPopup OnClick of a dynamically generated HtmlAnchor control. I need to create this ModalPopupExtender control dynamically in my server control and trigger it from within. I have been able to create it and trigger it from a button cre...

asp.net Web server control with child controls, event not firing

I have a simple web control (TaskList) that can have children (Task) which inherit from LinkButton, that can be added declaratively or programatically. This works ok, but I can't get the onclick event of a Task to be fired in my code behind. The code .. [ToolboxData("<{0}:TaskList runat=\"server\"> </{0}:TaskList>")] [ParseChildren...

How to embed JQuery into custom server control

I am writing a server control that is a search box with suggestions (when the user starts typing, matching words will appear for them to select). I am using jquery and C#. The control works fine when I include the jquery Lib on the page that I am testing on. However, it will not work when I attempt to embed the lib in the DLL. I have...

Adding MS AJAX to existing Custom Controls

Hello there! Currently im in the process of upgrading a number of asp.net 1.1 custom controls (all inherit from System.Web.UI.WebControls.WebControl, please not this is NOT a user control) to asp.net 4.0 and would like to use partial rendering. We used to use Anthem .net controls (these operated in a similar way to the UpdatePanel cont...

How to: Make a Custom Updatepanel Control Which Contains Updateprogress In It

I use updatepanel and updateprogress in my project. Whenever I add updatepanel to a page, then I should add updateprogress too. Now I want to make a custom control that include both updatepanel and updateprogress. If there are any controls like this, Can anyone give me its link. On other hands How to make a custom control likte that?...

ASP.NET Custom control and Page.Request.Form[]

Hi, I have a control that inherits from System.Web.UI.Control and contains generic HTML controls rather than asp.net server side controls. I use Page.Request.Form[Control_id] to get the value of one of the controls. This basically works accept if I have a gridview that contaiins a column of these custom controls and I add a new row [ro...

asp.net custom server control design time support

I'm having issues with a custom panel control in design view. Overriding the render method has no affect at design-time. If I extend a textbox as follows the design time showed the div tag and then the textbox control. Tried the same with the panel control and it did not show the div with the here text in it. Seems since panel is a c...

Using custom WebControl as DefaultButton for Panel

I have created a custom web control to act as a button with an image. I would like to be able to set this as the target of the DefaultButton parameter of an ASP.NET Panel control. I have implemented the IButton interface, and no error is generated when loading the page using the control. However, when I press enter in a textbox within...

asp.net server control - avoid adding multiple javascript

I created an asp.net Server control that derives from a LinkButton, and renders a small javascript function to the page. I want to use this control many times on the page, but just want the javascript to be rendered once on the page. On the other hand, I rather not manually add it in a js file, because i don't want to have a chance of f...