人生是一场不能存盘的RPG,我只能尽量多搞几个Screenshot

May 29, 2006

webcast_How do I Video Series_Create a Full-Featured Customer Login Portal

Filed under: ASP.NET

How do I? Video Series : Create a Full-Featured Customer Login Portal(hilo_intro_final.wmv)
http://asp.net/default.aspx?tabindex=4&tabid=3000
http://asp.net/learn/howdoi/default.aspx?tabid=63

全面介绍asp.net2.0 功能

1.DataView的data binding
使用northwinds.mdf数据库
在配置dataview 的data source时使用 select statement, 并设置 where clause,
指定source为QueryString, QueryString Field为CustomerID.
或指定source为control, ControlID为gridview1

如果要使用主从两个dataview,
需要在主gridview中设置DataKeyName,并添加select column

在从gridview中设置其data source的查询语句的source为control, ControlID为gridview1

2.使用Theme
App_Themes下建立某个theme对应的folder,将Theme相关的文件(包括.css,.skin, 图片) 放到文件夹中.

skin文件的写法:
<asp:TextBox BackColor=”Green” Runat=”Server” />
<asp:TextBox SkinID=”BlueTextBox” BackColor=”Blue” Runat=”Server” />
<asp:BulletedList BulletStyle=”CustomImage” BulletImageUrl=”BulletImages/OrangeBullet.gif” Runat=”Server” />
第一个skin不包含 SkinID,被当成默认skin,适用于所有的TextBox.

<system.web>
<pages theme=”ThemeName” styleSheetTheme=”ThemeName”/>
</system.web>

在某个Page中使用theme
<%@ Page Theme=”ThemeName” %>
<%@ Page StyleSheetTheme=”ThemeName” %>

将主题应用于页面时,主题中所设置的任何控件属性都优先于页面中所设置的任何属性。
例如,如果主题指定所有 TextBox 控件的背景都应当显示为橙色,那么即使个别 TextBox
控件的 BackColor 属性具有不同的值,页面中所有 TextBox 控件的背景也仍然都将显示为
橙色。

在 ASP.NET 中,优先级的顺序是:
Theme,包括 Web.config 文件中设置的主题。
Page
StyleSheetTheme
比如skin文件中定义:
<asp:Label runat=”server” ForeColor=”red” Font-Size=”14pt” Font-Names=”Verdana” />
Page中将Lable1.ForeColor 设置为 blue。
如果使用<pages theme=”ThemeName”>Lable1为 red,
如果使用<pages StyleSheetTheme=”ThemeName”>Lable1为 blue,

动态加载Theme

Protected void Page_PreInit(object sender, EventArgs e)
{
switch (Request.QueryString[”theme”])
{
case “Blue”:
Page.Theme = “BlueTheme”;
break;
case “Pink”:
Page.Theme = “PinkTheme”;
break;
}
}

3. 使用master page
快速修改一个page:
1. 删光所有代码,只剩<%@page
2. 在<%@page 中写 MasterPageFile=”"
3. 切换到design view, 选择”Create Custom Content”

4. 用户登录,权限
使用web site admin tool生成config, user account, user role
使用loginview
使用LinginStatus
使用CreateUserWizard

5. Site map
Web.sitemap
使用TreaView ,将datasource设为SitemapDatasource
使用SiteMapPath
在web.config中使用 securityTrimmingEnable=”true”,可过滤掉用户无权访问的链接.

6. 使用 profile
类似app setting,但是保存在sqlserver 中
在web.config中添加
<profile>
<properties>
<add name =”FullName” defaultValue= “”>
</properties>
</profile>
使用:
//读
if(!page.IsPostBack)
{
TextBox1.Text = Profile.FullName;
}
//写
Profile.FullName = TextBox1.text

参考
演练:在 Visual Studio 中使用主题自定义网站
http://msdn2.microsoft.com/zh-cn/library/zcsbskx7.aspx

Comments »

The URI to TrackBack this entry is: http://recordsome.blogsome.com/2006/05/29/webcast_how-do-i-video-series_create-a-full-featured-customer-login-portal/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham