A server control in classic ASP.NET is a component that dynamically renders a segment of markup to the client. Controls can be written in markup or coded, and can be bound to data and participate in different phases of the ASP.NET request-handling lifecycle. Out-of-box examples range from the simple (CheckBox which wraps the HTML input checkbox) and more complex (GridView which can be bound to various data sources and has built-in paging and sorting).
Questions tagged [servercontrols]
213 questions
4
votes
4 answers
ASP.NET Server Control Property Attribute must be required
I have a custom ASP.NET server control CustomControl with a property attribute Path.
If the Path is not explicitly specified, then I want an exception to be thrown.
For example,

smartcaveman
- 41,281
- 29
- 127
- 212
4
votes
3 answers
Test output from HtmlTextWriter
Quite simply I want to be able to test that a Asp.Net web forms server control is outputting the correct Html as it will be building dynamic content. I'm just starting to create the control and wanted to do it in a TDD style building up the Html…

Nathan
- 931
- 1
- 12
- 26
4
votes
3 answers
Are the Internet Explorer Web Controls IE only?
Recently, I came across a set of Internet Explorer Web Controls from Microsoft. These look to me to be older controls from the pre-standards era of Microsoft's asp.net development. I'm curious as to whether or not these controls work well with…

Erik Funkenbusch
- 92,674
- 28
- 195
- 291
4
votes
1 answer
Creating a simple templated control. Having issues
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…

James
- 449
- 3
- 7
4
votes
1 answer
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…

Brett Postin
- 11,215
- 10
- 60
- 95
4
votes
1 answer
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 tag.
Can you also do this with Cookies…

BuddyJoe
- 69,735
- 114
- 291
- 466
4
votes
1 answer
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…

Byron Sommardahl
- 12,743
- 15
- 74
- 131
4
votes
4 answers
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…

hoytster
- 247
- 4
- 15
4
votes
2 answers
Why do my dynamically added controls loose their values after Postback?
To ask my question I have created an aspx file containing a Button and a DataList with an SqlDataSource:

dvjanm
- 2,351
- 1
- 28
- 42
3
votes
1 answer
How to test asp.net server controls
We have developed a number of ASP.Net server controls and we need to test them. I want to instantiate a control, set some properties, call CreateChildControls and test the control-hierarchy.
I run into a number of problems:
The controls rely on…

RandomProgrammer
- 1,570
- 1
- 14
- 23
3
votes
1 answer
ASP.net weekly schedule control
Can anyone recommend a free asp.net control that I can use for the following:
Weekdays Monday-Saturday along the top row
Time of day along left hand side
Template fields for the actual data
Databindable
Cells span the rows based on the start time…

Ronnie Overby
- 45,287
- 73
- 267
- 346
3
votes
3 answers
Excel like server side control for ASP.NET
We have a requirement to increase the functionality of a grid we are using to edit on our webapp, and our manager keeps citing Excel as the perfect example for a data grid :/ He still doesn't really get that a Spreadsheet like control doesn't exist…

johnc
- 39,385
- 37
- 101
- 139
3
votes
3 answers
Can I automatically attach to the lifecycle of ANY server-enabled HTML tag?
If a "server-enabled" HTML tag is in a Web form, like this --
-- is there any way for me to attach to its rendering? I assume once they have runat="server", they must have a lifecycle of some kind.
I'd like to attach some code…

Deane
- 8,269
- 12
- 58
- 108
3
votes
1 answer
How do you insert a newline character within the RegularExpressionValidator ErrorMessage Field?
Consider this code below:

pointedPenguin
- 65
- 7
3
votes
1 answer
Add tag within tag in ServerControl (ASP.NET)?
I'm gonna use JQuery files in my custom ServerControl , thus I have to add below line within Head tag.
How can I do it in ServerControl with C#

Mohammad Dayyan
- 21,578
- 41
- 164
- 232