- <%@Page Language="vb" ValidateRequest="false" ContentType="text/html"%>
- <%@Register TagPrefix="dntb" Namespace="DotNetTextBox" Assembly="DotNetTextBox"%>
- <script runat="server" language="vb">
- Private Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
- If Not IsPostBack Then
- WebEditor1.Text = "<a href=http://www.aspxcn.com.cn><img src='system_dntb/skin/default/img/logo.gif' alt='DotNet中华网版权所有' width=260 height=60 border=0></a>"
- End If
- End Sub
- Private Sub Button1_Click(ByVal obj As Object, ByVal e As EventArgs)
- label1.Text = "<hr><b>以下是DotNetTextBox控件提交的内容</b>:<br>" + WebEditor1.Text
- End Sub
- Private Sub Button2_Click(ByVal obj As Object, ByVal e As EventArgs)
- WebEditor1.Text = ""
- End Sub
- Private Sub ChangedUser(ByVal obj As Object, ByVal e As EventArgs)
- WebEditor1.UploadConfig = selectuser.SelectedItem.Value + ".config"
- WebEditor1.UploadFolder = "upload/" + selectuser.SelectedItem.Value + "/"
- WebEditor1.MenuConfig = selectuser.SelectedItem.Value + ".config"
- Select Case selectuser.SelectedItem.Value
- Case "guest"
- WebEditor1.Width = 450
- WebEditor1.LeftAreaWidth = "45%"
- WebEditor1.RightAreaWidth = "55%"
- Case "user"
- WebEditor1.Width = 570
- WebEditor1.RightAreaAlign = "left"
- Case "administrator"
- WebEditor1.Width = 570
- WebEditor1.RightAreaAlign = "left"
- Case Else
- WebEditor1.Width = 560
- End Select
- End Sub
- </script>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <title>演示:用户权限应用实例(VB.NET)</title>
- <style type="text/css">
- <!--
- body {
- font-size: 9pt;
- }
- hr {
- border: dotted #AFAFAF;
- }
- input {
- font-size: 9pt;
- border: 1px ridge #999999;
- background-color: #FFFFFF;
- cursor:pointer;
- }
- TABLE {
- FONT: 9pt 宋体,Verdana,Arial
- }
- -->
- </style>
- </head>
- <body>
- <table id="TABLE1" align="center" width="555" language="javascript" onclick="return TABLE1_onclick()">
- <tr>
- <td valign="top">
- <fieldset>
- <legend>演示说明</legend> 本例子通过设置MenuConfig属性(实现不同权限用户显示不同的菜单界面)、设置UploadFolder属性(实现为不同权限用户创建不同的上传文件夹)、设置UploadConfig属性(实现不同权限的用户不同的上传权限),实际应用中可以结合自己项目的用户信息来动态配置这些属性!</fieldset>
- </td>
- </tr>
- </table>
- <br />
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align=center><form id="Form1" runat="server">
- <br />
- [切换用户]:<asp:dropdownlist id="selectuser" AutoPostBack="true" OnSelectedIndexChanged="ChangedUser" runat="server" Width="86px" >
- <asp:listitem value="default">默认用户</asp:listitem>
- <asp:listitem value="administrator">管理员</asp:listitem>
- <asp:listitem value="user">普通用户</asp:listitem>
- <asp:listitem value="guest">访客</asp:listitem>
- </asp:dropdownlist>
- <p align="center"><DNTB:WebEditor id="WebEditor1" Skin="skin/xp/" runat="server"></DNTB:WebEditor> </p>
- <p align="center">
- <asp:Button id="Button1" CssClass="input" OnClick="Button1_Click" runat="server" Text="提交内容"></asp:Button>
- <asp:Button id="Button2" CssClass="input" OnClick="Button2_Click" runat="server" Text="清空内容"></asp:Button>
- </p>
- </form></td>
- </tr>
- </table>
- <asp:label runat="server" ID="label1"></asp:label>
- </body>
- </html>