Terminology

Facts, Thoughts and Opinions

Hide a button on click

btn.Attributes.Add("onClientClick", " this.disabled = true; this.style.display = 'none'; " + ClientScript.GetPostBackEventReference(btn, Nothing) + ";")

User Controls vs. Custom Controls

User controls are custom, reusable controls, and they use the same techniques that are employed by HTML and Web server controls. They offer an easy way to partition and reuse common user interfaces across ASP.NET Web applications. They use the same Web Forms programming model on which a Web Forms page works.

Custom controls are compiled code components that execute on the server, expose the object model, and render markup text, such as HTML or XML, as a normal Web Form or user control does.

Factors User control Custom control
Purpose Designed for single-application scenarios. Designed for use across multiple applications.
Deployment Deployed in the source form (.ascx) along with the source code of the application. Deployed either in the application's Bin directory or in the global assembly cache.
Use in more than one application introduces redundancy and maintenance problems. Distributed easily and without problems associated with redundancy and maintenance.
Creation Similar to the way Web Forms pages are created; well-suited for rapid application development (RAD) Involves lots of code because there is no designer support.
Content More suited for static content within a fixed layout (e.g. headers and footers). More suited for dynamic content to be displayed; can be reused across an application, for example, for a data bound table control with dynamic rows.
Design Writing doesn't require much application designing because they are authored at design time and mostly contain static data. Writing from scratch requires a good understanding of the control's life cycle and the order in which events execute, which is normally taken care of in user controls.

Images

[[/div]]

  •   Writings

  Sources & Bookmarks