Click here to Skip to main content
13,829,543 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.
<%@ Page language="c#" Codebehind="ReadOnlyDialog.aspx.cs" AutoEventWireup="false" Inherits="Trivadis.Spieler.ReadOnly.ReadOnlyDialog" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="" name="vs_targetSchema">
		<LINK href="default.css" type="text/css" rel="stylesheet">
		<form id="Form1" method="post" runat="server">
			<P><STRONG>Demo-Webform (FlowLayout)</STRONG>
				<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="300" bgColor="whitesmoke" border="0">
						<TD width="100"><asp:label id="lblFirstnamed" runat="server" CssClass="lbl">Last name</asp:label></TD>
						<TD width="100"><asp:textbox id="txtLastname" runat="server" CssClass="txt" Width="150px">Spieler</asp:textbox></TD>
						<TD width="100"><asp:label id="lblFirstname" runat="server" CssClass="lbl">First name</asp:label></TD>
						<TD width="100">
							<P><asp:textbox id="txtFirstname" runat="server" CssClass="txt" Width="150px">Patrick</asp:textbox></P>
							<P><asp:label id="lblSex" runat="server" CssClass="lbl">Sex</asp:label></P>
						<TD><asp:dropdownlist id="ddlSex" runat="server">
								<asp:ListItem Value="Male">Male</asp:ListItem>
								<asp:ListItem Value="Female">Female</asp:ListItem>
						<TD width="100"><asp:label id="lblCity" runat="server" CssClass="lbl">City</asp:label></TD>
							<P><asp:radiobuttonlist id="optCity" runat="server" CssClass="lbl" BorderColor="Transparent">
									<asp:ListItem Value="Aarau">Aarau</asp:ListItem>
									<asp:ListItem Value="Basel">Basel</asp:ListItem>
									<asp:ListItem Value="Lugano">Lugano</asp:ListItem>
									<asp:ListItem Value="Z&#252;rich">Z&#252;rich</asp:ListItem>
						<TD width="100"><asp:label id="lblSwiss" runat="server" CssClass="lbl">Swiss</asp:label></TD>
							<P><asp:checkbox id="chkSwiss" runat="server" Checked="True"></asp:checkbox></P>
						<TD width="100"><asp:label id="lblHobby" runat="server" CssClass="lbl">Hobbies (MultiSelect)</asp:label></TD>
							<P><asp:listbox id="lstHobbies" runat="server" CssClass="txt" Width="150px" SelectionMode="Multiple">
									<asp:ListItem Value="Sport">Sport</asp:ListItem>
									<asp:ListItem Value="Travelling">Travelling</asp:ListItem>
									<asp:ListItem Value="Computer">Computer</asp:ListItem>
									<asp:ListItem Value="Nature">Nature</asp:ListItem>
									<asp:ListItem Value="Wine">Wine</asp:ListItem>
						<TD width="100"></TD>
						<TD width="100"></TD>
							<P><asp:button id=btnSave runat="server" CssClass="btn" Width="144px" Text="Save"></asp:button></P>
				</TABLE><BR><asp:LinkButton id=lnkReadOnly runat="server" DESIGNTIMEDRAGDROP="71">ReadOnly</asp:LinkButton>&nbsp; 
				<asp:LinkButton id=lnkBack runat="server" DESIGNTIMEDRAGDROP="71">Back</asp:LinkButton>&nbsp; 
				<asp:HyperLink id="hypGridLayout" runat="server" NavigateUrl="ReadOnlyGridDialog.aspx">Go to GridLayout Demopage</asp:HyperLink>

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
Web05 | 2.8.190114.1 | Last Updated 25 Feb 2004
Article Copyright 2004 by Patrick Spieler
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid