<configuration>
<configSections>
<section name="ExtAspNet" type="ExtAspNet.ConfigSection, ExtAspNet" requirePermission="false"/>
</configSections>
<ExtAspNet EnableBigFont="true" DebugMode="true" IconBasePath="~/Fineui/icon"/>
<!--連接字符串-->
<connectionStrings>
<add name="localOraclStr" connectionString="Data Source=192.168.2.244/orcl;User ID=platform;pwd=pf123;Unicode=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add assembly="ExtAspNet" namespace="ExtAspNet" tagPrefix="ext"/>
</controls>
</pages>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<modules>
<add name="ExtAspNetScriptModule" type="ExtAspNet.ScriptModule, ExtAspNet"/>
<!--<add type="wqcms.URLRewriter.ModzuleRewriter, wqcms_URLRewriter" name="ModuleRewriter" />-->
</modules>
<handlers>
<add name="ExtAspNetResourceHandler" verb="GET" path="res.axd" type="ExtAspNet.ResourceHandler, ExtAspNet"/>
</handlers>
</system.webServer>
</configuration>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<link href="Fineui/css/main.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<ext:PageManager ID="PageManager1" runat="server" />
<div>
用戶名:admin
<br />
密碼:admin
<br />
<ext:Window ID="Window1" runat="server" Title="登錄表單" IsModal="false" EnableClose="false"
WindowPosition="GoldenSection" Width="350px">
<Items>
<ext:SimpleForm ID="SimpleForm1" runat="server" ShowBorder="false" BodyPadding="10px"
LabelWidth="60px" EnableBackgroundColor="true" ShowHeader="false">
<Items>
<ext:TextBox ID="tbxUserName" Label="用戶名" Required="true" runat="server">
</ext:TextBox>
<ext:TextBox ID="tbxPassword" Label="密碼" TextMode="Password" Required="true" runat="server">
</ext:TextBox>
<ext:Button ID="btnLogin" Text="登錄" Type="Submit" ValidateForms="SimpleForm1" ValidateTarget="Top"
runat="server" OnClick="btnLogin_Click">
</ext:Button>
</Items>
</ext:SimpleForm>
</Items>
</ext:Window>
</div>
</form>
</body>
</html>
protected void btnLogin_Click(object sender, EventArgs e)
{
if (tbxUserName.Text == "admin" && tbxPassword.Text == "admin")
{
Alert.ShowInTop("成功登錄!");
}
else
{
Alert.ShowInTop("用戶名或密碼錯誤!", MessageBoxIcon.Error);
}
}
3、心得
關鍵在:Type="Submit" ValidateForms="SimpleForm1"