servercontrols

Web controls lifecycle problems: A page, a grid and a dialog (containing a dynamic control whose type depends on the selected row in the grid)

I have a web page with a GridView. The GridView contains a list of Question objects. Each Question has a QuestionType. When the user clicks on the Question control, an Ajax modal popup appears containing a Dialog custom web control. The Dialog web control is designed to encapsulate a child custom web control together with OK and Canc...

Page.ClientScript.RegisterClientScriptBlock and nested server controls

I'm using Page.ClientScript.RegisterClientScriptBlock on PreRender in a nested Server Control environment. The script does not get written to the page, does anyone know why this happens? protected override void OnPreRender(EventArgs e) { Page.ClientScript.RegisterClientScriptBlock(typeof(System.Web.UI.Page), "FMMedia", ...

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...

Server control/data access best practice?

Is it better to access data from within the web parent app and pass the necessary data to the control and back via properties, or pass a reference or url pointer (of webservice) to control and let it access the data for the fields it encompasses keeping in mind that the parent doesn't need to use the data anywhere else that the server co...

Always use SUBCLASSES of ASP.NET server controls? If not, why not?

In my pre-ASP.NET development environment, there was a near-universal best practice: * NEVER use the native controls! * Instead, subclass ALL the controls, and ALWAYS use the subclassed version. Why? Because that gave you a hook... one place to write code and have it applied throughout your application. For example: Suppose you decid...

is it strange to generate controls into placeholders to avoid the "ugly" long Control ClientID's?

More and more I dislike this long ID's by server controls... But the other method to generate it in codebehind I think is not the sense of the easy thing of asp.net, is it? So would you prefer that method by yourself? I'm going to create medium and big projects next year in company, thats the reason why I ask. Me self come from PHP and...

CompositeDataBoundControl - databound values overwritten before event is fired due to DummyDataSource

I have a custom servercontrol that inherits from CompositeDataBoundControl. I have three templates: one header template, one footer template and one item template. The item template can contain a checkbox that I use to decide if I should delete the item. In the footer and/or header templates I have a button with a CommandName of "Delet...

Is there a performance difference between custom server controls and user controls?

Consider two controls that do basically the same things. For instance, a gridview-like-widget with paging, sorting, and data caching. Both bound with the same 10,000 row data source. One is a custom server control and one is a user control. Is there any reason there would be any difference in performance? Just wondering that the communi...

How to embed a static image resource in a web server control?

I am going to create a web server control representing a treeview. So I want to use 2 images for + and - for expand/collapse. How can I build this into the control in a way that can be used as image source when rendered on the page? Since this will be in a compiled web controls library, I don't want to rely on external images in the we...

IPostBackDataHandler and the PostCollection in server control

The basic idea of what I want to do is: I've got 2 textboxes and a button that gets written from the server control, when the button is clicked, it should to a postback to the server where I want to extract the values posted in the textboxes and work with them. I have an implementation of the IPostbackDataHandler in the server control:...

How to set a custom id for listitems in BulletedList control while binding?

I am binding a BulletedList control in page load to a datasource, what i want to do is to set custom IDs for this BulletedList's ListItems while binding This custom ID will be in my current case "li_"+ItemId.ToString() Sample Code i used to fill the bulletedList: bulletedList.DataSource = MyDataCollection; bulletedList.DataTextField = ...

Page containing Microsoft Chart Control returns Service Unavailable

I have a frustrating problem with an asp.net mvc view containing the Microsoft Chart control. When I request the view containing the control I get the following error. Service Unavailable HTTP Error 503. The service is unavailable. When I run the project under the visual studio 2008 dev server it works fine. When I deploy th...

ASP.NET Server Controls and <%$ %> params like ConnectionStrings

Is there a complete list of the objects you can tap into with <%$ %> tags in ASP.NET I know you can do things like <%$ ConnectionStrings:northwind %> in the ConnectionString attribute of the <asp:SqlDataSource> tag. Can you also do this with Cookies and Session? Is there a <%$ %> reference page out there? ...

ScriptControlDescriptor.AddProperty & Read-Only Properties

I'm creating an ASP.NET Server Control with an associated client-side API. In my GetScriptDescriptors() method I'm associating a property called "rows"... descriptor.AddProperty("rows", this.IntRows); In my client-side API I want my "rows" property to be read-only... MyControl = function(element) { MyControl.initializeBase(this,...

Form tag in view

I am planning to rebuilding the code of one asp.net project to another asp.net project. but i am stuck some where ... i drag and dropped the master page and the views (4 nos) into the master page. Now i need to recode what is there in the view using designer Shown below the code inside the first view. How i could recreate it using th...

CssClass and default images in ServerContol

I'm writing a ServerControl in ASP.NET 3.5, and I'm exposing CssClass, so the user can manipulate the visual appearance of the control. My problem is that I want to establish reasonable defaults, so that the user doesn't have to configure CSS unless he wants to change the defaults. My specific problem is that my control is emitting htm...

Creating a simple templated control. Having issues...

Hi, I'm trying to create a really simple templated control. I've never done it before, but I know a lot of my controls I have created in the past would have greatly benefited if I included templating ability - so I'm learning now. The problem I have is that my template is outputted on the page but my property value is not. So all I ge...

ASP .NET confusion - server controls

I have read through the information in this question: http://stackoverflow.com/questions/22084/asp-net-aspxxx-controls-versus-standard-html but am still rather confused. The situation was I was asked to do a web project where I made a wizard. When I was done with the project everyone asked why I had used an <asp:Wizard...>. I thought th...

Creating an ASP.Net Templated Server control

Hi, I want to be able to do something like this <test:TabControl id="" runat="server"....> <ItemTemplate> <tabItem label="tab1" /> <tabItem label="tab2" /> </ItemTemplate> </test> The idea being here is that the only acceptable items in "ItemTemplates" are the tabitem types. There are many asp.net controls tha...

ASP.Net Templated Server Controls difference between UpdatePanel and other controls

Hi, Using the advise given on this post... http://stackoverflow.com/questions/2908260/creating-an-asp-net-templated-server-control ... I was able to create a nice templated server control. However, what I noticed is that on some templated controls such as the ASP.Net UpdatePanel you dont need to use FindControl to find the actual co...