This post shows a generic method that can return the HTML string generated by ASP.NET server control after the rendering.
string GetRenderedOutput<T>(T control) where T : Control
StringBuilder builder = new StringBuilder();
using (StringWriter sWriter = new StringWriter(builder))
using (Html32TextWriter writer = new Html32TextWriter(sWriter))
While reading an algorithms book, I learned that minor optimizations and choosing right algorithm can improve the code performance drastically. In this post we will see how this is happening.
Consider the following trivial code to calculate a Fibonacci value of a number using recursion.
int fibonacci(int num)
if (num < = 1)
return fibonacci(num - 1) + fibonacci(num - 2);
Here is how this code executes for
fibonacci(5). Continue reading
When a custom control is created, Visual Studio will show it in the toolbox for dragging and dropping. This can be annoying when you create a composite control which is a combination of several other custom controls where VS will display all custom controls in the toolbox.
System.ComponentModel.ToolBoxItemAttribute can be used with the controls that you want to hide from toolbox. Apply this attribute to all the controls that you want to hide from toolbox.
public class MyCustomControl : Label
MyCustomControl will not be displayed on the toolbox.