您的位置:首页 > 运维架构

WebPart中自定义Enum以呈现下拉框(Dropdownlist)供用户选择(downmoon)

2005-07-08 16:45 387 查看
Webp0art中自定义Enum以呈现下拉框供用户选择!~



public

enum
EnumSystemCatalog






...
{



最新文档
=
0
,



即时商情
=
1
,



人事动态
=
2
,



在线培训
=
3
,



文档管理
=
4
,



内控制度
=
5
,



常用软件
=
6
,



公告中心
=
7
,



资产事业群
=
8
,



最热文档
=
100



}








protected
EnumSystemCatalog _enumSystem
=
EnumSystemCatalog.最新文档;







[Browsable(
true
),



Category(
"
Miscellaneous
"
),



DefaultValue(EnumSystemCatalog.最新文档),



WebPartStorage(Storage.Personal),



FriendlyName(
"
选择系统类别
"
),



Description(
"
选择系统类别
"
)]




public
EnumSystemCatalog EnumSystem






...
{




get






...
{




return
_enumSystem;



}




set






...
{



_enumSystem
=
value;



}



}









private

void
BindGrid()






...
{



strSystemID
=
getSystemIDByCatalog();




//
strSystemID=EnumSystem.ToString();




try






...
{



svNewDocs
=
new
NewServiceDocs.ServerForNewDocs();



dsNewDocs
=
new
DataSet();




if
(
this
.strSystemID
==
"
0
"
)






...
{




this
.lblMoreUrl.Text
=
""
;



dsNewDocs
=
svNewDocs.getNewDocsOfAllSystem(
int
.Parse(
this
.strCounter));
//
new DataSet();







}




else

if
(
this
.strSystemID
==
"
100
"
)






...
{




this
.lblMoreUrl.Text
=
""
;



dsNewDocs
=
svNewDocs.getNewDocsOfHottest(
int
.Parse(
this
.strCounter));
//
new DataSet();







}




else






...
{




this
.lblMoreUrl.Text
=
" http://ep-hgh.buynow.com.cn/instantMessage/frmNewIndex.aspx?lngSysID= "
+
strSystemID;



dsNewDocs
=
svNewDocs.getNewDocsBySystemID(
int
.Parse(
this
.strCounter),
this
.strSystemID);
//
new DataSet();



}



dgNewDocs.DataSource
=
dsNewDocs;
//
cmd.ExecuteReader();
//
ordersView;



dgNewDocs.DataBind();



}




catch
(Exception ex)






...
{



ErrorLabel.Text
=
ex.Message
+

"
<br>
"
;



ErrorLabel.Visible
=

true
;







}









ErrorLabel.Visible
=

false
;







}




private

string
getSystemIDByCatalog()






...
{




switch
(
this
.EnumSystem.ToString())






...
{








case

"
最新文档
"
:




return

"
0
"
;




case

"
即时商情
"
:




return

"
1
"
;




case

"
人事动态
"
:




return

"
2
"
;




case

"
在线培训
"
:




return

"
3
"
;




case

"
文档管理
"
:




return

"
4
"
;




case

"
内控制度
"
:




return

"
5
"
;




case

"
常用软件
"
:




return

"
6
"
;




case

"
公告中心
"
:




return

"
7
"
;




case

"
资产事业群
"
:




return

"
8
"
;




case

"
最热文档
"
:




return

"
100
"
;




default
:




return

"
0
"
;



}



}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: