CSharp
-
How to create custom controls in ASP.NET part 3 of 3
Deploying Custom Controls
If you're using the Visual Studio IDE, maybe you don't know the building way from the command line. I have two files (FoxyGridView.cs and FoxyGridView.Methods.cs) and I need to generate the build from the command line. So the sintax is the next:
C:\Program Files\Microsoft Visual Studio 9.0\VC> csc /t:library /out:FoxyGridView.dll /r:System.dll /r:System.Data /r:System.Drawing /r:System.Web FoxyGridView.cs FoxyGridView.Methods.cs
Also we can set the control assembly properties, a strong assembly name consists of four parts: assembly name, version, culture, and public token key. Only we need to create a file named AssemblyInfo.css (or maybe other name), with the following code to the file:
Read More...using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyKeyFile("KeyFile.snk")]
-
How to create custom controls in ASP.NET part 2 of 3
State Management
Previusly in the last post we saw the web custom controls attributes. We can interactive with the web user control through its attributes.
To implement a custom control, you have to implement a class in procedural lenguages as C# or VB.NET that derives from a base class such as Control. Every server control directly or indirectly derives from the Control base class.
The base class Control provides server controls with the infrastructure they need to operate as a server control in the ASP.NET framework. One of these infrastructural methods is a method named Render. This method is where a server control generates or renders its HTML markup text.
For example, if you wish to put a html table into the page, you need to use the next code or similar code:
Read More... -
How to create custom controls in ASP.NET part 1 of 3
This is my first post in English, I need more practice so ... If you find some error in my redaction, feel free to comment about it.
For understand the topic is necesary to know the basic differences between user controls and custom controls:
User Control- Designed for single-application scenarios
- Deployed in the source form (.ascx) along with the source code of the application
- If the same control needs to be used in more than one application, it introduces redundancy and maintenance problems
- Designed so that it can be used by more than one application
- Deployed either in the application's Bin directory or in the global assembly cache
- Distributed easily and without problems associated with redundancy and maintenance
Read More...