custom-server-controls

Which is more efficient for rendering a server control in ASP.NET

I am outputting the entire HTML for my server control as follows: public override void Render(HtmlTextWriter output) { output.Write(myStringBuilder.ToString()); } myStringBuilder is a StringBuilder object that is manually built in a separate private method. Is this an efficient way to do it? Or is it better to pass the HtmlTextWrit...

NullReferenceException after turning ascx UserControl into reusable server control using Microsoft's tips

A supposedly proven technique to turn UserControls of a website into reusable server controls while retaining the ability to use declarative code gives me a NullReferenceException on any reference of any control that's declared inside the ASCX code. When calling the ASCX from the same project, this problem does not occur. The idea is t...

How can I access textbox properties in a custom validator?

I want to build a custom validator control that inherits from BaseValidator. It will only be used on textboxes in my asp.net application. How can I get access to the textbox itself (read properties of the textbox) within the custom validator? Here is what I have in my EvaluateIsValid function: Dim t As TextBox = CType(Page.FindCon...

Recommendations for a ASP.NET Forum control?

I am looking for a Forum server-side asp.net control that will integrate into my asp.net 3.5 site. I've seen a ton over at www.asp.net in their gallery page, but almost none have ratings, so difficult to determine which are reliable and which will turn into a nightmare. Recommendations? Both free and paid components are welcome. ...

ASP.NET Server control emitting server side tags

I'm new to writing custom ASP.NET server controls, and I'm encountering the following issue: I have a control that inherits from System.Web.UI.HtmlControls.HtmlGenericControl. I override the control's Render method, use the HtmlTextWriter to emit some custom HTML (basically a TD tag with some custom attributes), and then call the case c...

Visual Studio uses UserControlDesigner instead of CustomDesigner

Hi! I've got an ASP-UserControl QuestionWithAnswer (.ascx) : BaseQuestion : UserControl and a ControlDesigner QuestionDesigner : UserControlDesigner. Now i use the DesignerAttribute to associate control and designer: [Designer(typeof(QuestionDesigner))] public class BaseQuestion : UserControl all types are in the same assembly (WEB A...

Creating a custom GridView control that supports DynamicData

I'm very disappointed in the built-in GridView control. I wanted to make a simple data-entry web application, thinking Dynamic Data would save me time. But it turns out that the GridView doesn't even support basic user interface scenarios such as inserting a new row. Since the project I'm building will incorporate this scenario a lot,...

Should I buy Obout? Help, Please.

We started a new project and the nature of the project is very interactive and a Rich UI is required. We would need a set of controls that would require for Rich UI development. I found Obout while googling. I never heard about them and never seen fellow members telling me such name except Telerik, ComponentOne, NetAdvantage. These are...

Reading an embedded file from an ASP.NET Custom Server Control an rendering it

I currently have a file "abc.htm" in my Custom Server Control Project and it's Build Action is set to Embedded Resource. Now in the RenderContents(HtmlTextWriter output) method, I need to read that file and render it on the website. I am trying the following but it's to no avail: protected override void RenderContents(HtmlTextWriter o...

Do I need to use any other attributes other than CssClassProperty to enabled design-time support?

Hi, I'm trying to provide the same design-time support that the CssClass provides on some custom properties of a server control. The documentation suggests that decorating the property with the CssClassProperty is all that's required. [CssClassProperty] public string SomeOtherCssClass{get;set;} This has no effect, in vs2008 or vs201...

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

How to build a GridView like DataBound Templated Custom ASP.NET Server Control

I am trying to develop a very simple templated custom server control that resembles GridView. Basically, I want the control to be added in the .aspx page like this: <cc:SimpleGrid ID="SimpleGrid1" runat="server"> <TemplatedColumn>ID: <%# Eval("ID") %></ TemplatedColumn> <TemplatedColumn>Name: <%# Eval("Name") %></ ...

Invoking code both before and after WebControl.Render method

I have a set of custom ASP.NET server controls, most of which derive from CompositeControl. I want to implement a uniform look for "required" fields across all control types by wrapping each control in a specific piece of HTML/CSS markup. For example: <div class="requiredInputContainer"> ...custom control markup... </div> ...

Give Markup support for Custom server control with public PlaceHolders properties

I have a custom server control with two public PlaceHolder properties exposed to outside. I can use this control in a page like this: <cc1:MyControl ID="MyControl1" runat="server"> <TitleTemplate> Title text and anything else </TitleTemplate> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server"></asp:...

User Control SiteMap Provider Rendering Error

I have created a Custom Server Control that renders the SiteMap as a pure UL for CSS styling. At run-time it renders properly but in VS2008 Design View VS shows this error: Error Rendering Control - menuMainAn unhandled exception has occurred. The provider 'AspNetXmlSiteMapProvider' specified for the defaultProvider does no...

DataSourceID vs DataSource - Messing with my Custom Repeater

I have made a Custom Repeater. In the DataBind event, I am using a PagedDataSource (which persists) and I am determining how to grab my data from there. This works fine when I bind a datasource directly to the control. However, when I use the DataSourceID property, it binds the data, but my PagedRepeater doesn't work anymore. This leads ...

Custom controls in 2008

Using custom controls in VS 2008 shows frequent errors like object reference not set to an instance of an object and 'could not be set on prperty'. I have to use the existing custom control created by other team. But when implemeting those controls in my page show the error as i have mentioned for an example Section panel has the p...

Problem using a costum server control in a aspx

Hi guys, i am having a issue. I already developed one class (my custom gridview) and i want use it on a .aspx That class is defined in app_code and compiled to the dll of the project. namespace MyCostumControls{  public class DropDownPagingGridView : GridView{ ... I already registered the control on the aspx page using <%@ Regist...

Viewstate vs Postback

I sort of answered my own question I think but I want to make sure I am understanding correctly. I initially thought that when a user provided values in a form, that on postback the values were submitted as part of the Viewstate, because TextBox.Text is part of the viewstate. Now I have found that user supplied values actually aren't ...

Add custom template in custom repeater

Hi, I have a class which extends from repeater class. Basically I need a custom repeater which should have this layout:        <HeaderTemplate>        </HeaderTemplate>        <MyTemplate>         </MyTemplate>        <ItemTemplate>        </ItemTemplate>      <FooterTemplate>    </FooterTemplate> Till now I have written this cod...