<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Validate" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
ErrorMessage="Must indicate a skill!"
ControlToValidate="skills">
Indicate your skills
Recognized skills
File: Default.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public partial class Validate : System.Web.UI.MobileControls.MobilePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ArrayList values = new ArrayList();
values.Add("ASP.NET");
values.Add("ADO.NET");
values.Add("XML");
values.Add("Windows Forms");
values.Add("SQL Server");
skills.DataSource = values;
skills.DataBind();
}
}
protected void Submit(object sender, EventArgs e)
{
if (!Page.IsValid)
return;
string buf = "";
foreach (MobileListItem item in skills.Items)
buf += (item.Selected ? item.Text + ", " : "");
buf = buf.TrimEnd();
if (buf.EndsWith(","))
buf = buf.TrimEnd(',');
Results.Text = buf;
ActiveForm = ResultsForm;
}
}