Library tutorials & articles
Make your Classic ASP code work like in ASP.NET
- Introduction
- Using the Code
- Drop Down Example
- DrillDown Example
- DataGrid Example
- Tabs Example
- RadioButton Example
RadioButton Example
<!--#Include File = "..\WebControl.asp" -->
<!--#Include File = "..\Server_LinkButton.asp" -->
<!--#Include File = "..\Server_CheckBox.asp" -->
<!--#Include File = "..\Server_RadioButton.asp" -->
<!--#Include File = "..\Server_Label.asp" -->
<!--#Include File = "DBWrapper.asp" -->
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>CheckBox and CheckBoxList Example</TITLE>
<LINK rel="stylesheet" type="text/css" href="Samples.css">
</HEAD>
<BODY>
<!--#Include File = "Home.asp" -->
<%
Call Main()
%>
<Span Class="Caption">CHECKBOX EXAMPLES</Span>
<span><br>AutoPostBack = True is used for this example...</span>
<!--#Include File = "..\FormStart.asp" -->
<%lblMessage%><HR>
<%chkHideShow%> | <%chkTableLayOut%> | <%chkHorizontalDirection%> | <%chkShowGrid%><HR>
<%optRadioList%>
<HR>
<%cmdAdd%> | <%cmdRemove%> | <%cmdAddColumnOrRow%> | <%cmdRemoveColumnOrRow%>
<!--#Include File = "..\FormEnd.asp" -->
</BODY>
</HTML>
<% 'This would normaly go in a another page, but for the sake of simplicity and to minimize the number of pages
'I'm including code behind stuff here...
Dim lblMessage
Dim cmdAdd
Dim cmdRemove
Dim cmdAddColumnOrRow
Dim cmdRemoveColumnOrRow
Dim chkHideShow
Dim chkTableLayOut
Dim chkHorizontalDirection
Dim optRadioList
Dim chkShowGrid
Page.DebugEnabled = False
Public Function Page_Init()
Set lblMessage = New_ServerLabel("lblMessage")
Set cmdAdd = New_ServerLinkButton("cmdAdd")
Set cmdRemove = New_ServerLinkButton("cmdRemove")
Set cmdAddColumnOrRow = New_ServerLinkButton("cmdAddColumnOrRow")
Set cmdRemoveColumnOrRow = New_ServerLinkButton("cmdRemoveColumnOrRow")
Set chkHideShow = New_ServerCheckBox("chkHideShow")
Set chkHorizontalDirection = New_ServerCheckBox("chkHorizontalDirection")
Set chkTableLayOut = New_ServerCheckBox("chkTableLayOut")
Set optRadioList = New_ServerRadioButtonList("optRadioList")
Set chkShowGrid = New_ServerCheckBox("chkShowGrid")
optRadioList.AutoPostBack=true
End Function
Public Function Page_Controls_Init()
cmdAdd.Text = "Add"
cmdRemove.Text = "Remove"
cmdAddColumnOrRow.Text = "Add Column"
cmdRemoveColumnOrRow.Text = "Remove Column"
lblMessage.Control.Style = "border:1px solid blue;background-color:#EEEEEE;width:100%;font-size:8pt"
lblMessage.Text = "This is an Example"
chkHideShow.Caption = "Hide/Show List"
chkHideShow.AutoPostBack = True
chkTableLayOut.Caption = "Table Layout"
chkTableLayOut.Checked = True
chkTableLayOut.AutoPostBack = True
chkHorizontalDirection.Caption = "Horizontal Flow"
chkHorizontalDirection.AutoPostBack=True
chkShowGrid.Caption = "Show Grid"
chkShowGrid.AutoPostBack = True
optRadioList.DataTextField = "TerritoryDescription"
optRadioList.DataValueField = "TerritoryID"
Set optRadioList.DataSource = GetRecordset("SELECT TerritoryID,TerritoryDescription FROM Territories ORDER BY 2")
optRadioList.DataBind() 'Loads the items collection (that will stay in the viewstate)...
Set optRadioList.DataSource = Nothing 'Clear
optRadioList.RepeatColumns=4
End Function
Public Function Page_PreRender()
Dim msg
Set msg = New StringBuilder
msg.Append "chkHideShow Is checked? " & chkHideShow.Checked & "<BR>"
msg.Append "<B>RepeatColumns: </B>" & optRadioList.RepeatColumns & "<BR>"
msg.Append "<B>RepeatLayOut: </B>" & optRadioList.RepeatLayOut & "<BR>"
msg.Append "<B>RepeatDirection: </B>" & optRadioList.RepeatDirection & "<BR>"
msg.Append "<B>SelectedValue: </B>" & optRadioList.Items.GetSelectedValue & "<BR>"
msg.Append "<B>SelectedText: </B>" & optRadioList.Items.GetSelectedText & "<BR>"
msg.Append "<HR>"
lblMessage.Text = msg.ToString()
End Function
Public Function chkHideShow_Click()
optRadioList.Control.Visible = Not optRadioList.Control.Visible
End Function
Public Function chkTableLayOut_Click()
If chkTableLayOut.Checked Then
optRadioList.RepeatLayout = 1
Else
optRadioList.RepeatLayout = 2
End If
End Function
Public Function chkShowGrid_Click()
If chkShowGrid.Checked Then
optRadioList.BorderWidth = 1
Else
optRadioList.BorderWidth=0
End If
End Function
Public Function chkHorizontalDirection_Click()
If chkHorizontalDirection.Checked Then
optRadioList.RepeatDirection=1
Else
optRadioList.RepeatDirection = 2
End If
End Function
Public Function cmdAdd_OnClick()
optRadioList.Items.Add optRadioList.Items.Count,optRadioList.Items.Count,False
End Function
Public Function cmdRemove_OnClick()
optRadioList.Items.Remove optRadioList.Items.Count-1
End Function
Public Function cmdAddColumnOrRow_OnClick()
optRadioList.RepeatColumns = optRadioList.RepeatColumns + 1
End Function
Public Function cmdRemoveColumnOrRow_OnClick()
If optRadioList.RepeatColumns - 1 >0 Then
optRadioList.RepeatColumns = optRadioList.RepeatColumns -1
End If
End Function
%>
Related articles
Related discussion
-
How to debug classic ASP pages during AJAX calls in ASP.NET website
by andwan0 (0 replies)
-
Menu.css corrupting my other theme.css
by Montague (0 replies)
-
GridView cell colour change
by viral.mat (1 replies)
-
need Regular Expression for strong password
by bussureddy82 (4 replies)
-
Gridview -> Template Field -> Button
by antti.simonen (1 replies)
Related podcasts
-
Developer's Guide to IIS7
Steve Schofield is an IIS expert working for webhost ORCS Web. Steve and his team are responsible for such sites as Channel9, ASP.NET, weblogs.asp.net and ASP Alliance. As a member ASP Insiders and a IIS MVP - Steve knows his way around a web server. Steve sheds light on how the new features in I...
Events coming up
-
Mar
15
DevWeek 2010
London, United Kingdom
DevWeek is Europe’s leading independent conference for software developers, database professionals and IT architects, and features expert speakers on a wide range of topics, including .NET 4.0, Silverlight 3, WCF 4, Visual Studio 2010, REST, Windows Workflow 4, Thread Synchronization, ASP.NET 4.0, SQL Server 2008 R2, LINQ, Unit Testing, CLR & C# 4.0, .NET Patterns, WPF 4, F#, Windows Azure, ADO.NET, Entity Framework, Debugging, T-SQL Tips & Tricks, and more.
Hi. I have several ASP 3.0 to EXCEL 10.0 reports thaqt work fine. When I try to go to EXCEL 11.0, I get an invalid class. How do I set that up for my object?
Thanks,Mac Kimsey mackimsey@yahoo.com
http://clasp.csharpjunkie.com/
This thread is for discussions of Make your Classic ASP code work like in ASP.NET.