FineUI學習筆記2

第二章  簡單登錄頁面

從第二章開始算是正式學習了,有點不解的地方就是教程是先用另一個dll,ExtAspNet。直接用FineUI不好麼?
1、下載好以下東西先:
ExtAspNet:博主要求先用的控件。
Newtonsoft.Json.dll:需要添加的引用,不然會報錯。
FineUI的資源文件,再添加引用FredCK.FCKeditorV2.dll,不然也會報錯。
2、先進行web.config全局設置。
<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>




2、新控件ext:Window ,可以像一個模式窗口一樣隨便拉動,很炫。特殊屬性WindowPosition="GoldenSection"
3、新控件ext:SimpleForm,簡單表單,我想應該是。。。


<%@ 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、心得
1)Alert的提示
2)window窗體控件,和他的屬性WindowPosition="GoldenSection"
3)控件ext:SimpleForm,簡單表單,和button配合用。
關鍵在:Type="Submit" ValidateForms="SimpleForm1"



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章