Click here to Skip to main content
13,836,489 members
Click here to Skip to main content
Articles » Web Development » ASP.NET » Howto » Downloads


41 bookmarked
Posted 24 Feb 2004

Enable ReadOnly Mode for your WebForms!

, 24 Feb 2004
This article will show you, how to implement a readonly mode for webforms.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Trivadis.Spieler.ReadOnly
	/// <summary>
	/// Summary description for ReadOnlyDialog.
	/// </summary>
	public class ReadOnlyDialog : BasePage
		protected System.Web.UI.WebControls.DropDownList ddlSex;
		protected System.Web.UI.WebControls.TextBox txtLastname;
		protected System.Web.UI.WebControls.TextBox txtFirstname;
		protected System.Web.UI.WebControls.Label lblCity;
		protected System.Web.UI.WebControls.RadioButtonList optCity;
		protected System.Web.UI.WebControls.Label lblFirstname;
		protected System.Web.UI.WebControls.Label lblLastname;
		protected System.Web.UI.WebControls.Label lblSex;
		protected System.Web.UI.WebControls.Label lblSwiss;
		protected System.Web.UI.WebControls.Label lblFirstnamed;
		protected System.Web.UI.WebControls.Label lblHobby;
		protected System.Web.UI.WebControls.ListBox lstHobbies;
		protected System.Web.UI.WebControls.HyperLink hypGridLayout;
		protected System.Web.UI.WebControls.Button btnSave;
		protected System.Web.UI.WebControls.LinkButton lnkReadOnly;
		protected System.Web.UI.WebControls.LinkButton lnkBack;
		protected System.Web.UI.WebControls.CheckBox chkSwiss;
		private void Page_Load(object sender, System.EventArgs e)
			if (!this.IsPostBack)
				btnSave.Attributes.Add("onclick","javascript:alert('Not implemented now.');");

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
			this.lnkReadOnly.Click += new System.EventHandler(this.lnkReadOnly_Click);
			this.Load += new System.EventHandler(this.Page_Load);


		private void lnkReadOnly_Click(object sender, System.EventArgs e)


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Patrick Spieler
Web Developer
Switzerland Switzerland
Consultant for Trivadis AG in Switzerland.
Interested in .NET, Architectures, Patterns and Web 2.0.
Blog and articles at

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.190114.1 | Last Updated 25 Feb 2004
Article Copyright 2004 by Patrick Spieler
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid