ASP.NET编程规范

ASP.NET编程规范


<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script> name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-3012773987023668&dt=1167915396250&lmt=1155665058&alternate_ad_url=http%3A%2F%2Fwww.shumablog.com%2Fad%2F336x280.htm&format=336x280_as&output=html&channel=8443961838&url=http%3A%2F%2Fasp.shumablog.com%2Fdream%2Fhtml%2FASP%2F4997.html&color_bg=EFFBBD&color_text=4A6129&color_link=4A6129&color_url=4A6129&color_border=EFFBBD&ad_type=text_image&ref=http%3A%2F%2Fasp.shumablog.com%2Fdream%2Fhtml%2FASP%2F5030.html&cc=100&u_h=768&u_w=1280&u_ah=734&u_aw=1280&u_cd=32&u_tz=480&u_his=3&u_java=true" frameborder="0" width="336" scrolling="no" height="280" allowtransparency="allowtransparency">

第一部分:界面设计标准

1.开发环境设置:屏幕设置为800*600/1024*768

2.界面设计原则:风格必须统一

3.B/S结构开发原则:使用框架/模板

4.页面使用表格(Table)进行格式设置。

最外面的表格设置:width=778px align=center border=0

5.主页面Body设置:bgcolor="#cccccc"

6.框架子页面Body设置:bottomMargin="0" leftMargin="0"

7.对齐:文字(标签)右对齐;数字(数据)右对齐;文字(数据)左对齐,比较短的可以居中对齐;金额,需加上 千位符

8.冒号必须是在中文输入状态下键入

9.控件使用原则:尽可能使用Html控件,需要提交而又不用在客户端使用Javasrcipt的可以使用Web控件

10.控件使用约定:

(1)控件外观设置:style.css

i.i 链接类:

a:link {font-size: 12px;line-height: 20px;text-decoration: none; color: #666666}

a:visited {font-size: 12px;line-height: 20px;color: #666666;text-decoration:

none;}

a:hover {font-size: 12px;line-height: 20px;color: #FF6600;text-decoration:

underline;}

a:active {font-size: 12px;line-height: 20px;color: #666666;text-decoration:

underline;}

i.ii 表格类:

td{font-size: 12px; line-height: 20px; text-decoration: none;}

i.iii 文本框类:

.inputPM{BORDER-RIGHT: #99ccff 1px solid; BORDER-TOP: #99ccff 1px solid;

BORDER-LEFT: #99ccff 1px solid; BORDER-BOTTOM: #99ccff 1px solid;

HEIGHT: 22px}

i.iv datagrid类:

.dg_grid /* Grid-总体 */

{font-size:12px; border-style:solid; border-width:2px; border-color:White;

text-align:center; vertical-align:middle;}

.dg_header /* Grid-页眉 */

{font-weight :bold ; color:#E7E7FF; background-color :#3366CC; text-align:center;

vertical-align:middle; height:25px;}

.dg_alter /* Grid-交替行 */

{background-color :AliceBlue; height:22px;}

.dg_item /* Grid-普通行 */

{color :Black; background-color:WhiteSmoke; height:22px;}

.dg_page /* Grid-页导航 */

{color:Black; text-align:right; vertical-align:middle; height:22px;}

.dg_select{font-weight :bold ; color:White; background-color :#9471DE;} /* Grid-选择行 */

(2)几点补充:

ii.i 控件datagrid的数据显示:文字(短)居中对齐;文字(长)左对齐;日期左对齐;数字左对齐;金额左对齐,千位符

ii.ii 控件text的长度MaxLength按数据结构要求设置

ii.iii 因为操作主要跟数据库相关,所以控件类型可以与数据表字段(field)类型形成对应,此处约定为:

u 字段类型为文本、数字时,控件使用文本框

u 字段类型为布尔值时,控件使用单项选择按钮(checkbox控件)或下拉框

u 字段内容在固定的几个值中选择时(不论其类型),控件使用下拉框

u 字段类型为日期时间时,控件使用文本框 按钮(按钮可以选择日期,按钮.Value=”…”)

u 字段为其它表的外键,则分为两种情况:

a)、如果是属于基本资料的,控件使用下拉框。

b)、如果不是属于基本资料的,控件使用文本框 按钮(按钮用于跳出查询窗口,按说钮.Value=”…”

u 数据操作窗口一般为DataGrid 录入框

a)、DataGrid用于显示数据

b)、录入框用于输入/显示数据

c)、浏览窗口基本样式,主要以表格形式显示纪录,单表控件使用DataGrid/DataList/Repeater,多表使用NestedDataGrid

第二部分:命名规范

1. 按钮ID命名:btn 按钮操作功能(如btnSave)

2. 其它控件:

I. 与数据操作相关:其ID<.SPAN>为相应的字段名称,如果有多个控件对应一个字段,则按以下规范命名:

字段名 ”_” 顺序号(以01开头)

例子:页面有一TextBox控件,对应着数据库表中的RightGroup字段,则其ID应命名为 RightGroup

如果页面有二个TextBox控件,都对应着数据库表中的PowerGroup字段,则其ID分别命名为PowerGroup_01, PowerGroup_02,依此类推

II. 其它:前缀 用途功能(如txtInput),前缀请看表一:

控件

前缀

控件

前缀

Form

frm

Class

cls/C

Module

mod

Label

lbl

LinkLabel

lnk

Button

btn

TextBox

txt

CheckBox

chk

RadioButton

rad

GroupBox

grp

PictureBox

pic

DataGrip

grd

ListBox

lst

CheckedListBox

clst

ComboBox

cbo

TreeView

tvw

ListView

lvw

TabControl

tab

DateTimePicker

dtp

Timer

tmr

Splitter

spl

ProgressBar

pbar

RichTextBox

rtf

ImageList

imgl

ToolBar

tlb

MenuItem

mnu

(表一)

3. 变量及常量命名规范 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值