Dev系列控件综合实例(分层的提出,异步上传文件)

 在我的其他随笔中,已经介绍了Dev系列控件的相关数据展示,操作等等。这里主要介绍在数据操作中结合ajax、dev控件、分层进行数据操作,包括对二进制数组文件的上传。

分层的提出

    在B/S下进行数据维护,主要包括数据的检索、更新维护。在进行数据更新的时候我们需要结合数据库结构对数据进行校验,这里我使用js结合ajax来调用webservice实现数据校验,校验完毕后,进入数据逻辑层进行相关数据操作。(关于三层架构以及多层架构的文章很多,这里不累赘,只说明结合使用dev控件结合js来进行数据展示层和校验层的操作)

异步实现二进制文件的上传

     我们在实现文件上传到数据库的时候,都需要通过相关的上传控件进行,一般的上传控件我们需要在后台进行数据转换成二进制数组。由于上传控件是使用js上传,所以很难通过异步来实现上传(当然优秀的Jquery和定制的可以)。这里通过dev控件中的Uploadcontrol捕捉到uploadcomplete事件,直接得到二进制数组,并将其存入session(由于比较大,在上传入数据库后,我们最好将session清空)

aspx:

    
    
< dxuc:ASPxUploadControl ID ="devUploadCode" runat ="server" ClientInstanceName ="devUploadCode" OnFileUploadComplete ="devUploadCode_FileUploadComplete" ShowProgressPanel ="True" ShowUploadButton ="True" > < UploadButton Text ="上传" > </ UploadButton > < ClientSideEvents FileUploadComplete ="function(s, e) { onCodeCompleted(s,e); }" /> </ dxuc:ASPxUploadControl >

CS:

    
    
protected void devUploadWord_FileUploadComplete( object sender, FileUploadCompleteEventArgs e) { Session[ " WordFile " ] = (sender as ASPxUploadControl).UploadedFiles[ 0 ].FileBytes; }

下面是详细的代码:

1、展示层

aspx:

    
    
<% @ Page Language = " C# " AutoEventWireup = " true " CodeFile = " ImportSource.aspx.cs "
Inherits = " content_ImportSource " EnableEventValidation = " false " %> <% @ Register Assembly = " DevExpress.Web.v9.2, Version=9.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a " Namespace = " DevExpress.Web.ASPxHiddenField " TagPrefix = " dxhf " %> <% @ Register Assembly = " DevExpress.Web.ASPxTreeList.v9.2, Version=9.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a " Namespace = " DevExpress.Web.ASPxTreeList " TagPrefix = " dxwtl " %> <% @ Register Assembly = " DevExpress.Web.v9.2, Version=9.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a " Namespace = " DevExpress.Web.ASPxUploadControl " TagPrefix = " dxuc " %> <% @ Register Assembly = " DevExpress.Web.v9.2, Version=9.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a " Namespace = " DevExpress.Web.ASPxPanel " TagPrefix = " dxp " %> <% @ Register Assembly = " DevExpress.Web.v9.2, Version=9.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a " Namespace = " DevExpress.Web.ASPxCallbackPanel " TagPrefix = " dxcp " %> <% @ Register Assembly = " DevExpress.Web.v9.2, Version=9.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a " Namespace = " DevExpress.Web.ASPxClasses " TagPrefix = " dxw " %> <% @ Register Assembly = " DevExpress.Web.v9.2, Version=9.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a " Namespace = " DevExpress.Web.ASPxTabControl " TagPrefix = " dxtc " %> <% @ Register Assembly = " DevExpress.Web.ASPxGridView.v9.2, Version=9.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a " Namespace = " DevExpress.Web.ASPxGridView " TagPrefix = " dxwgv " %> <% @ Register Assembly = " DevExpress.Web.ASPxEditors.v9.2, Version=9.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a " Namespace = " DevExpress.Web.ASPxEditors " TagPrefix = " dxe " %> <% @ Register Assembly = " DevExpress.Web.v9.2, Version=9.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a " Namespace = " DevExpress.Web.ASPxPopupControl " TagPrefix = " dxpc " %> <% @ Register Assembly = " System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 " Namespace = " System.Web.UI " TagPrefix = " asp " %> <! 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 id ="Head1" runat ="server" > < title > 无标题页 </ title > < link rel ="stylesheet" href ="../Css/main.css" type ="text/css" /> < link rel ="stylesheet" href ="../css/common.css" type ="text/css" /> </ head > < body > < form id ="form1" runat ="server" > < asp:ScriptManager ID ="ScriptManager1" runat ="server" EnablePageMethods ="True" > < Scripts > < asp:ScriptReference Path = " ../js/ImportSource.js " / > </ Scripts > < Services > < asp:ServiceReference Path ="ImportSourceService.asmx" /> </ Services > </ asp:ScriptManager > < table width ="97%" border ="0" cellspacing ="0" cellpadding ="0"
style ="margin-top:2px; margin-left:2px;" > < tr > < td > < dxpc:ASPxPopupControl ID ="devpopupcProject" runat ="server" Width ="300px"
Height ="100px" AllowDragging ="False" AllowResize ="True" EnableAnimation ="False" EnableHierarchyRecreation ="True" EnableHotTrack ="False" HeaderText ="工程分类"
PopupHorizontalAlign ="OutsideLeft" ShowFooter ="False" ClientInstanceName ="devpopupcProject" > < ContentCollection > < dxpc:PopupControlContentControl runat ="server" > < dxcp:ASPxCallbackPanel ID ="devcbpnlProInfo" runat ="server"
Width ="300px" Height ="100px" OnCallback ="devcbpnlProInfo_Callback" ClientInstanceName ="pnlProject"
LoadingPanelText ="加载中..." > < PanelCollection > < dxp:PanelContent runat ="server" > < asp:Label ID ="lblProInfo" runat ="server" Width ="300px" Height ="100px" ></ asp:Label > </ dxp:PanelContent > </ PanelCollection > </ dxcp:ASPxCallbackPanel > </ dxpc:PopupControlContentControl > </ ContentCollection > </ dxpc:ASPxPopupControl > < dxpc:ASPxPopupControl ID ="devpopupModel" runat ="server" Width ="300px" Height ="100px" AllowDragging ="False" AllowResize ="True" EnableAnimation ="False" EnableHierarchyRecreation ="True" EnableHotTrack ="False" HeaderText ="模型分类"
PopupHorizontalAlign ="OutsideLeft" ShowFooter ="False" ClientInstanceName ="devpopupModel" > < ContentCollection > < dxpc:PopupControlContentControl ID ="PopupControlContentControl1" runat ="server" > < dxcp:ASPxCallbackPanel ID ="devcbpnlModel" runat ="server"
Width ="300px" Height ="100px" OnCallback ="devcbpnlModel_Callback" ClientInstanceName ="devcbpnlModel"
LoadingPanelText ="加载中..." > < PanelCollection > < dxp:PanelContent ID ="PanelContent1" runat ="server" > < asp:Label ID ="lblModel" runat ="server" Width ="300px" Height ="100px" ></ asp:Label > </ dxp:PanelContent > </ PanelCollection > </ dxcp:ASPxCallbackPanel > </ dxpc:PopupControlContentControl > </ ContentCollection > </ dxpc:ASPxPopupControl > < dxpc:ASPxPopupControl ID ="devpopupBook" runat ="server" Width ="300px" Height ="100px" AllowDragging ="False" AllowResize ="True" EnableAnimation ="False" EnableHierarchyRecreation ="True" EnableHotTrack ="False" HeaderText ="相关文献"
PopupHorizontalAlign ="OutsideLeft" ShowFooter ="False" ClientInstanceName ="devpopupBook" > < ContentCollection > < dxpc:PopupControlContentControl ID ="PopupControlContentControl2" runat ="server" > < dxcp:ASPxCallbackPanel ID ="devcbpnlBook" runat ="server" Width ="300px" Height ="100px" OnCallback ="devcbpnlBook_Callback" ClientInstanceName ="devcbpnlBook"
LoadingPanelText ="加载中..." > < PanelCollection > < dxp:PanelContent ID ="PanelContent2" runat ="server" > < asp:Label ID ="lblBook" runat ="server" Width ="300px" Height ="100px" ></ asp:Label > </ dxp:PanelContent > </ PanelCollection > </ dxcp:ASPxCallbackPanel > </ dxpc:PopupControlContentControl > </ ContentCollection > </ dxpc:ASPxPopupControl > < dxpc:ASPxPopupControl ID ="devpopupKeyWord" runat ="server" Width ="300px" Height ="100px" AllowDragging ="False" AllowResize ="True" EnableAnimation ="False" EnableHierarchyRecreation ="True" EnableHotTrack ="False" HeaderText ="关键字"
PopupHorizontalAlign ="OutsideLeft" ShowFooter ="False" ClientInstanceName ="devpopupKeyWord" > < ContentCollection > < dxpc:PopupControlContentControl ID ="PopupControlContentControl3" runat ="server" > < dxcp:ASPxCallbackPanel ID ="devcbpnlKeyWord" runat ="server" Width ="300px" Height ="100px" OnCallback ="devcbpnlKeyWord_Callback" ClientInstanceName ="devcbpnlKeyWord"
LoadingPanelText ="加载中..." > < PanelCollection > < dxp:PanelContent ID ="PanelContent3" runat ="server" > < asp:Label ID ="lblKeyWord" runat ="server" Width ="300px" Height ="100px" ></ asp:Label > </ dxp:PanelContent > </ PanelCollection > </ dxcp:ASPxCallbackPanel > </ dxpc:PopupControlContentControl > </ ContentCollection > </ dxpc:ASPxPopupControl > < dxpc:ASPxPopupControl ID ="devpopupFunction" runat ="server" Width ="300px" Height ="100px" AllowDragging ="False" AllowResize ="True" EnableAnimation ="False" EnableHierarchyRecreation ="True" EnableHotTrack ="False" HeaderText ="功能简述"
PopupHorizontalAlign ="OutsideLeft" ShowFooter ="False" ClientInstanceName ="devpopupFunction" > < ContentCollection > < dxpc:PopupControlContentControl ID ="PopupControlContentControl7" runat ="server" > < dxcp:ASPxCallbackPanel ID ="devcbpnlFunction" runat ="server" Width ="300px" Height ="100px" OnCallback ="devcbpnlFunction_Callback" ClientInstanceName ="devcbpnlFunction"
LoadingPanelText ="加载中..." > < PanelCollection > < dxp:PanelContent ID ="PanelContent4" runat ="server" > < asp:Label ID ="lblFunction" runat ="server" Width ="300px" Height ="100px" ></ asp:Label > </ dxp:PanelContent > </ PanelCollection > </ dxcp:ASPxCallbackPanel > </ dxpc:PopupControlContentControl > </ ContentCollection > </ dxpc:ASPxPopupControl > < dxpc:ASPxPopupControl ID ="ASPxPopupControl1" runat ="server" Width ="300px" Height ="400px" AllowDragging ="True" AllowResize ="True" EnableAnimation ="False" CloseAction ="CloseButton" Modal ="true" EnableHierarchyRecreation ="True" EnableHotTrack ="False" HeaderText ="工程分类"
PopupHorizontalAlign ="RightSides" ShowFooter ="True" ClientInstanceName ="devpopupAllProjcet" > < ContentCollection > < dxpc:PopupControlContentControl ID ="PopupControlContentControl5" runat ="server" > < asp:Panel ID ="Panel1" runat ="server" Width ="98%" Height ="98%" ScrollBars ="Auto" > < dxwtl:ASPxTreeList ID ="trlProjcet" runat ="server" KeyFieldName ="projectid" ParentFieldName ="ParID" AutoGenerateColumns ="False" ClientInstanceName ="trlProjcet" OnCustomCallback ="trlProjcet_CustomCallback" > < Columns > < dxwtl:TreeListTextColumn VisibleIndex ="0" FieldName ="projectname" ></ dxwtl:TreeListTextColumn > < dxwtl:TreeListTextColumn Visible ="False" VisibleIndex ="1" FieldName ="projectid" ></ dxwtl:TreeListTextColumn > </ Columns > < Settings ShowColumnHeaders ="False" /> < SettingsBehavior AllowFocusedNode ="True" FocusNodeOnLoad ="False" FocusNodeOnExpandButtonClick ="False" /> < SettingsSelection Enabled ="True" /> </ dxwtl:ASPxTreeList > </ asp:Panel > </ dxpc:PopupControlContentControl > </ ContentCollection > < FooterTemplate > < input id ="btnSaveProject" type ="button" value ="选择工程分类" onclick ="btnSaveProject_Click()" /> </ FooterTemplate > </ dxpc:ASPxPopupControl > < dxwgv:ASPxGridView ID ="devgvwData" runat ="server" OnRowDeleting ="devgvwData_RowDeleting" OnRowInserting ="devgvwData_RowInserting" OnRowUpdating ="devgvwData_RowUpdating" OnStartRowEditing ="devgvwData_StartRowEditing" AutoGenerateColumns ="False" KeyFieldName ="sourceid" OnInitNewRow ="devgvwData_InitNewRow" OnCustomCallback ="devgvwData_CustomCallback" OnCustomButtonCallback ="devgvwData_CustomButtonCallback" OnHtmlEditFormCreated ="devgvwData_HtmlEditFormCreated" ClientInstanceName ="grid" Cursor ="default" oncustomjsproperties ="devgvwData_CustomJSProperties" > < Styles > <Header HorizontalAlign="Center" Wrap="False"></Header> <Row Wrap="False"></Row> <FocusedRow BackColor="#3B97D3"></FocusedRow> </ Styles > < Columns > < dxwgv:GridViewCommandColumn ButtonType ="Image" Caption ="操作" VisibleIndex ="0" Width ="80px" > < EditButton Text ="编辑" Visible ="True" > < Image Url ="~/images/Update_hui.png" /> </ EditButton > < NewButton Text ="增加" Visible ="True" > < Image Url ="~/images/Add_hui.png" /> </ NewButton > < DeleteButton Text ="删除" Visible ="True" > < Image Url ="~/images/Del_hui.png" /> </ DeleteButton > < CancelButton Text ="取消" > < Image Url ="~/images/quxiao.jpg" /> </ CancelButton > < UpdateButton Text ="更新" > < Image Url ="~/images/gengxin.jpg" /> </ UpdateButton > < CustomButtons > < dxwgv:GridViewCommandColumnCustomButton ID ="Copy" Text ="克隆" > < Image Url ="~/images/Save_hui.png" /> </ dxwgv:GridViewCommandColumnCustomButton > </ CustomButtons > < CellStyle Wrap ="False" Cursor ="pointer" ForeColor ="Black" > </ CellStyle > </ dxwgv:GridViewCommandColumn > < dxwgv:GridViewDataColumn Caption ="资源ID" FieldName ="sourceid" VisibleIndex ="1" Width ="80px" > < HeaderStyle HorizontalAlign ="Center" /> < CellStyle HorizontalAlign ="Left" ForeColor ="Black" > </ CellStyle > </ dxwgv:GridViewDataColumn > < dxwgv:GridViewDataTextColumn Caption ="资源名称" FieldName ="sourcename" VisibleIndex ="2" Width ="200px" > < HeaderStyle HorizontalAlign ="Center" /> < CellStyle HorizontalAlign ="Left" ForeColor ="Black" > </ CellStyle > </ dxwgv:GridViewDataTextColumn > < dxwgv:GridViewDataTextColumn Caption ="建模人" FieldName ="modelperson" VisibleIndex ="3" Width ="60px" > < HeaderStyle HorizontalAlign ="Center" /> < CellStyle HorizontalAlign ="Center" > </ CellStyle > </ dxwgv:GridViewDataTextColumn > < dxwgv:GridViewDataTextColumn Caption ="审核人" FieldName ="checkperson" VisibleIndex ="4" Width ="60px" > < HeaderStyle HorizontalAlign ="Center" /> < CellStyle HorizontalAlign ="Center" > </ CellStyle > </ dxwgv:GridViewDataTextColumn > < dxwgv:GridViewDataTextColumn Caption ="发放时间" FieldName ="releasetime" VisibleIndex ="5" Width ="80px" > < HeaderStyle HorizontalAlign ="Center" /> < CellStyle HorizontalAlign ="Center" > </ CellStyle > </ dxwgv:GridViewDataTextColumn > < dxwgv:GridViewDataTextColumn Caption ="完成时间" FieldName ="completetime" VisibleIndex ="6" Width ="80px" > </ dxwgv:GridViewDataTextColumn > < dxwgv:GridViewDataTextColumn Caption ="关键字" VisibleIndex ="7" Width ="60px" > < DataItemTemplate > < a href ="javascript:void(0);"
onclick ="onKeyWordCategory(this, '<%# Eval(" sourceid") % > ')" >关键字 </ a > </ DataItemTemplate > < HeaderStyle HorizontalAlign ="Center" /> < CellStyle ForeColor ="Black" HorizontalAlign ="Center" Wrap ="False" Cursor ="pointer" > </ CellStyle > </ dxwgv:GridViewDataTextColumn > < dxwgv:GridViewDataTextColumn Caption ="工程分类" VisibleIndex ="8" Width ="60px" > < DataItemTemplate > < a href ="javascript:void(0);"
onclick ="onProjectCategory(this, '<%# Eval(" sourceid") % > ')" >工程分类 </ a > </ DataItemTemplate > < HeaderStyle HorizontalAlign ="Center" /> < CellStyle ForeColor ="Black" HorizontalAlign ="Center" Wrap ="False" > </ CellStyle > </ dxwgv:GridViewDataTextColumn > < dxwgv:GridViewDataColumn Caption ="模型分类" VisibleIndex ="9" Width ="60px" > < DataItemTemplate > < a href ="javascript:void(0);"
onclick ="onModelCategory(this, '<%# Eval(" sourceid") % > ')" >模型分类 </ a > </ DataItemTemplate > < HeaderStyle HorizontalAlign ="Center" /> < CellStyle HorizontalAlign ="Center" > </ CellStyle > </ dxwgv:GridViewDataColumn > < dxwgv:GridViewDataColumn Caption ="相关文献" VisibleIndex ="10" Width ="60px" > < DataItemTemplate > < a href ="javascript:void(0);"
onclick ="OnFromCategory(this, '<%# Eval(" sourceid") % > ')" >相关文献 </ a > </ DataItemTemplate > < HeaderStyle HorizontalAlign ="Center" /> < CellStyle HorizontalAlign ="Center" > </ CellStyle > </ dxwgv:GridViewDataColumn > < dxwgv:GridViewDataColumn Caption ="功能概述" VisibleIndex ="11" > < DataItemTemplate > < a href ="javascript:void(0);"
onclick ="OnFunctionCategory(this, '<%# Eval(" sourceid") % > ')" >功能概述 </ a > </ DataItemTemplate > < HeaderStyle HorizontalAlign ="Left" /> < CellStyle HorizontalAlign ="Left" > </ CellStyle > </ dxwgv:GridViewDataColumn > </ Columns > < Templates >< EditForm > < div style ="padding:10px 4px 10px 4px;" > < table style ="font-size:12px; border-collapse:collapse; border-style:solid;
border:solid 1px #D7D7D7;" id ="Table1" border ="0" cellpadding ="0" cellspacing ="0" width ="98%" align ="center" > < tr > < td valign ="top" style ="height: 32px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label2" runat ="server" Text ="资源ID:" Width ="88px" ></ asp:Label > </ td > < td valign ="top" style ="height: 32px" class ="TdBj" > < asp:TextBox ID ="txtSourceID" runat ="server" Text ='<%# Eval("sourceid") % > ' MaxLength="14"> </ asp:TextBox > </ td > < td valign ="top" style ="height: 32px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label3" runat ="server" Text ="资源名称:" Width ="78px" ></ asp:Label > </ td > < td valign ="top" style ="height: 32px" class ="TdBj" > < asp:TextBox ID ="txtSourceName" runat ="server" Text ='<%# Eval("sourcename") % > '
MaxLength="100" Width="250px"> </ asp:TextBox > </ td > </ tr > < tr > < td colspan ="4" class ="TDLine" ></ td > </ tr > < tr valign ="top" > < td style ="height: 31px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label4" runat ="server" Text ="建模人:" ></ asp:Label > </ td > < td style ="height: 31px" class ="TdBj" > < asp:TextBox ID ="txtModelPerson" runat ="server" Text ='<%# Eval("modelperson") % > ' MaxLength="25"> </ asp:TextBox > </ td > < td style ="height: 31px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label5" runat ="server" Text ="审核人:" ></ asp:Label > </ td > < td style ="height: 31px" class ="TdBj" > < asp:TextBox ID ="txtCheckPerson" runat ="server" Text ='<%# Eval("checkperson") % > ' MaxLength="25"> </ asp:TextBox > </ td > </ tr > < tr > < td colspan ="4" class ="TDLine" ></ td > </ tr > < tr > < td style ="height: 32px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label6" runat ="server" Text ="下放时间:" ></ asp:Label > </ td > < td style ="height: 32px" class ="TdBj" > < dxe:ASPxDateEdit ID ="devDateRelease" runat ="server" Text ='<%# Eval("releasetime")% > '> < CalendarProperties ClearButtonText ="清空" TodayButtonText ="今天" /> </ dxe:ASPxDateEdit > </ td > < td style ="height: 31px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label10" runat ="server" Text ="完成时间:" ></ asp:Label > </ td > < td style ="height: 31px" class ="TdBj" > < dxe:ASPxDateEdit ID ="devDataComplete" runat ="server" Text ='<%# Eval("completetime")% > '> < CalendarProperties ClearButtonText ="清空" TodayButtonText ="今天" /> </ dxe:ASPxDateEdit > </ td > </ tr > < tr > < td colspan ="4" class ="TDLine" ></ td > </ tr > < tr > < td style ="height: 32px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label9" runat ="server" Text ="关键字:" ></ asp:Label > </ td > < td style ="height: 32px" class ="TdBj" > < asp:TextBox ID ="txtKeyWord" runat ="server" Text ='<%# Eval("keyword") % > ' MaxLength="100" Width="250px" οnblur="onKeyWordBlur()"> </ asp:TextBox > </ td > < td style ="height: 31px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label12" runat ="server" Text ="模型分类:" ></ asp:Label > </ td > < td style ="height: 31px" class ="TdBj" > < asp:TextBox ID ="txtModel" runat ="server" Text ='<%# Eval("modelname") % > '
MaxLength="50" Width="250px"> </ asp:TextBox > </ td > </ tr > < tr > < td colspan ="4" class ="TDLine" ></ td > </ tr > < tr > < td style ="height: 31px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label14" runat ="server" Text ="工程分类:" ></ asp:Label > </ td > < td style ="height: 31px" class ="TdBj" colspan ="3" > < dxe:ASPxComboBox ID ="ASPxComboBox1" runat ="server" ClientInstanceName ="txtProjectID" oncallback ="ASPxComboBox1_Callback" ClientVisible ="False" > </ dxe:ASPxComboBox > < asp:TextBox ID ="txtProject" Text ='<%# Eval("projectname") % > ' runat="server"
ReadOnly="true"> </ asp:TextBox > < input id ="btnSelectProjcet" type ="button" value ="选择工程分类"
onclick ="btnSelectProjcet_Click(this)" /> </ td > </ tr > < tr > < td colspan ="4" class ="TDLine" ></ td > </ tr > < tr > < td style ="height: 31px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label16" runat ="server" Text ="相关文献:" ></ asp:Label > </ td > < td style ="height: 31px" class ="TdBj" colspan ="3" > < asp:TextBox ID ="txtBook" runat ="server" Text ='<%# Eval("bookname") % > '
MaxLength="200" Width="611px"> </ asp:TextBox > </ td > </ tr > < tr > < td colspan ="4" class ="TDLine" ></ td > </ tr > < tr valign ="top" > < td style ="height: 31px" class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="lblCreateTime" runat ="server" Text ="功能简述:" ></ asp:Label > </ td > < td style ="height: 31px" class ="TdBj" colspan ="3" > < asp:TextBox ID ="txtFunInfo" runat ="server"
Text ='<%# Eval("funInfo") % > ' Width="611px"> </ asp:TextBox > </ td > </ tr > < tr > < td colspan ="4" class ="TDLine" ></ td > </ tr > < tr valign ="top" > < td class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label1" runat ="server" Text ="上传文档:" ></ asp:Label > </ td > < td style ="height: 31px" class ="TdBj" > < dxuc:ASPxUploadControl ID ="devUploadWord" runat ="server" ClientInstanceName ="devUploadWord" OnFileUploadComplete ="devUploadWord_FileUploadComplete" ShowProgressPanel ="True" ShowUploadButton ="True" > < UploadButton Text ="上传" > </ UploadButton > < ClientSideEvents FileUploadComplete ="function(s, e) { onWordCompleted(s,e); }" /> </ dxuc:ASPxUploadControl > < dxe:ASPxLabel ID ="ASPxLabel1" runat ="server" ClientInstanceName ="lblWordSuccess" ClientVisible ="False" Text ="上传成功" Font-Bold ="True" ForeColor ="Red" > </ dxe:ASPxLabel > </ td > < td class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label11" runat ="server" Text ="上传DLL:" ></ asp:Label > </ td > < td style ="height: 31px" class ="TdBj" > < dxuc:ASPxUploadControl ID ="devUploadDll" runat ="server" ClientInstanceName ="devUploadDll" OnFileUploadComplete ="devUploadDll_FileUploadComplete" ShowProgressPanel ="True" ShowUploadButton ="True" > < UploadButton Text ="上传" > </ UploadButton > < ClientSideEvents FileUploadComplete ="function(s, e) { onDllCompleted(s,e); }" /> </ dxuc:ASPxUploadControl > < dxe:ASPxLabel ID ="ASPxLabel2" runat ="server" ClientInstanceName ="lblDllSuccess" ClientVisible ="False" Text ="上传成功" Font-Bold ="True" ForeColor ="Red" > </ dxe:ASPxLabel > </ td > </ tr > < tr > < td colspan ="4" class ="TDLine" ></ td > </ tr > < tr valign ="top" > < td class ="TdBj" > &nbsp;&nbsp; < asp:Label ID ="Label7" runat ="server" Text ="上传代码:" ></ asp:Label > </ td > < td style ="height: 31px" class ="TdBj" colspan ="3" > < dxuc:ASPxUploadControl ID ="devUploadCode" runat ="server" ClientInstanceName ="devUploadCode" OnFileUploadComplete ="devUploadCode_FileUploadComplete" ShowProgressPanel ="True" ShowUploadButton ="True" > < UploadButton Text ="上传" > </ UploadButton > < ClientSideEvents FileUploadComplete ="function(s, e) { onCodeCompleted(s,e); }" /> </ dxuc:ASPxUploadControl > < dxe:ASPxLabel ID ="ASPxLabel3" runat ="server" ClientInstanceName ="lblCodeSuccess" ClientVisible ="False" Text ="上传成功" Font-Bold ="True" ForeColor ="Red" > </ dxe:ASPxLabel > </ td > </ tr > < tr id ="tr1" visible ="False" runat ="server" > < td id ="Td2" class ="err_meaages_css" colspan ="2" runat ="server" >
< asp:Label ID ="Label8" Visible ="False" runat ="server" Font-Size ="12px" Font-Bold ="True" ></ asp:Label ></ td > </ tr > </ table > </ div > < div style ="text-align:center; padding:2px 2px 2px 2px" > < img alt ="更新" src ="../images/gengxin.jpg" onclick ="return btnUpdate_onclick()" /> < dxwgv:ASPxGridViewTemplateReplacement ID ="CancelButton"
ReplacementType ="EditFormCancelButton" runat ="server" ></ dxwgv:ASPxGridViewTemplateReplacement > </ div > </ EditForm > </ Templates > < SettingsBehavior ConfirmDelete ="True" /> < SettingsText PopupEditFormCaption ="编辑资源" CommandUpdate ="更新" CommandCancel ="取消" ConfirmDelete ="确认要删除当前资源么?" EmptyDataRow ="无数据" /> < SettingsEditing PopupEditFormHorizontalAlign ="WindowCenter"
PopupEditFormVerticalAlign ="WindowCenter" Mode ="PopupEditForm" PopupEditFormModal ="True"
PopupEditFormWidth ="800px" PopupEditFormAllowResize ="True" /> < SettingsPager AlwaysShowPager ="True" > < FirstPageButton Text ="首页" > </ FirstPageButton > < LastPageButton Text ="尾页" > </ LastPageButton > < NextPageButton Text ="下一页" > </ NextPageButton > < PrevPageButton Text ="上一页" > </ PrevPageButton > < Summary Text ="当前第{0}页 共{1}页 {2}项" /> </ SettingsPager > < Settings ShowHorizontalScrollBar ="True" ShowVerticalScrollBar ="True" /> </ dxwgv:ASPxGridView > </ td > </ tr > < tr > < td style ="background-image:url(../Images/main_center_left.jpg); background-repeat:repeat-y;" class ="style2" > &nbsp; </ td > </ tr > </ table > </ form > </ body > </ html >

CS:

    
    
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; using System.Text; using System.Data.SqlClient; using DevExpress.Web.ASPxEditors; using DevExpress.Web.ASPxUploadControl; using DevExpress.Web.ASPxGridView; using DevExpress.Web.ASPxCallbackPanel; /* ****************************************************************************************************** ** 编码人:*** ** 编码时间:2010年2月22日 ** 编码内容简介:资源管理 ** 说明:Session["DTAllSource"]——所有资源 Session["CodeFile"]——上传代码文件 Session["WordFile"]——上传word文件 *Session["DllFile"]——上传Dll文件 Session["SourceID"]——资源ID Session["State"]——当前状态 *Session["ProjcetData"]——工程分类 Session["RefreshProjectID"]——修改完的工程分类ID *未处理模型分类,所属文献 * ****************************************************************************************************** / public partial class content_ImportSource : System.Web.UI.Page { Hashtable HashCopySource = null ; string [] DataSourceFields = new string [] { " sourceid " , " sourcename " , " releasetime " , " completetime " ,
" modelperson " , " checkperson " , " funInfo " }; protected void Page_Load( object sender, EventArgs e) { if (Session[ " IsLogin " ] == null || ! ( bool )Session[ " IsLogin " ]) { Response.Redirect( " ../index.aspx " ); return ; } if ( ! IsPostBack) { if (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width == 1440 ) { devgvwData.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width - 254 ; devgvwData.Settings.VerticalScrollableHeight = System.Windows.Forms.Screen.
PrimaryScreen.Bounds.Height - 433 ; } if (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width == 1024 ) { devgvwData.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width - 279 ; devgvwData.Settings.VerticalScrollableHeight = System.Windows.Forms.
Screen.PrimaryScreen.Bounds.Height - 450 ; } Session[ " DTAllSource " ] = DataBindings.MergeAllSource(DataBindings.GetAllSource()); } BindTable((DataTable)Session[ " DTAllSource " ]); if (Request.Form[ " __CALLBACKID " ] != null && Request.Form[ " __CALLBACKID " ].Contains( " trlProjcet " )) { trlProjcet.DataSource = Session[ " ProjcetData " ] as DataTable; } } /// <summary> /// 列表绑定数据 /// </summary> /// <param name="DT"></param> void BindTable(DataTable DT) { devgvwData.DataSource = DT; devgvwData.DataBind(); } protected void devgvwData_CustomButtonCallback( object sender, ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == " Copy " ) { HashCopySource = new Hashtable(); foreach ( string strField in DataSourceFields) { HashCopySource[strField] = devgvwData.GetRowValues(e.VisibleIndex, strField); } devgvwData.AddNewRow(); } } protected void devgvwData_CustomCallback( object sender, ASPxGridViewCustomCallbackEventArgs e) { } protected void devgvwData_HtmlEditFormCreated( object sender, ASPxGridViewEditFormEventArgs e) { } protected void devgvwData_InitNewRow( object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) { devgvwData.SettingsText.PopupEditFormCaption = " 添加资源 " ; devgvwData.JSProperties[ " cp_key " ] = "" ; // 清空键值 Session[ " CopyKey " ] = null ; if (HashCopySource != null ) { foreach ( string strField in DataSourceFields) { e.NewValues[strField] = HashCopySource[strField]; if (strField == " sourceid " ) { Session[ " CopyKey " ] = HashCopySource[strField].ToString().Trim(); } } } else { TextBox txtModelPerson = (TextBox)devgvwData.FindEditFormTemplateControl( " txtModelPerson " ); TextBox txtCheckPerson = (TextBox)devgvwData.FindEditFormTemplateControl( " txtCheckPerson " ); ASPxDateEdit devDateRelease = (ASPxDateEdit)devgvwData.FindEditFormTemplateControl( " devDateRelease " ); ASPxDateEdit devDataComplete = (ASPxDateEdit)devgvwData.FindEditFormTemplateControl( " devDataComplete " ); txtCheckPerson.Text = Session[ " yhmc " ].ToString(); txtModelPerson.Text = Session[ " yhmc " ].ToString(); devDateRelease.Date = DateTime.Now; devDataComplete.Date = DateTime.Now; } } protected void devgvwData_RowDeleting( object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { DataBindings.DeleteSource(e.Keys[ 0 ].ToString().Trim()); Session[ " DTAllSource " ] = DataBindings.MergeAllSource(DataBindings.GetAllSource()); BindTable((DataTable)Session[ " DTAllSource " ]); devgvwData.CancelEdit(); e.Cancel = true ; } protected void devgvwData_RowInserting( object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { TextBox txtSourceID = (TextBox)devgvwData.FindEditFormTemplateControl( " txtSourceID " ); TextBox txtSourceName = (TextBox)devgvwData.FindEditFormTemplateControl( " txtSourceName " ); TextBox txtModelPerson = (TextBox)devgvwData.FindEditFormTemplateControl( " txtModelPerson " ); TextBox txtCheckPerson = (TextBox)devgvwData.FindEditFormTemplateControl( " txtCheckPerson " ); ASPxDateEdit devDateRelease = (ASPxDateEdit)devgvwData.FindEditFormTemplateControl( " devDateRelease " ); ASPxDateEdit devDataComplete = (ASPxDateEdit)devgvwData.FindEditFormTemplateControl( " devDataComplete " ); TextBox txtFunInfo = (TextBox)devgvwData.FindEditFormTemplateControl( " txtFunInfo " ); TextBox txtKeyWord = (TextBox)devgvwData.FindEditFormTemplateControl( " txtKeyWord " ); byte [] Word = null ; byte [] Dll = null ; byte [] Code = null ; if (Session[ " WordFile " ] != null ) Word = Session[ " WordFile " ] as byte []; if (Session[ " DllFile " ] != null ) Dll = Session[ " DllFile " ] as byte []; if (Session[ " CodeFile " ] != null ) Code = Session[ " CodeFile " ] as byte []; DataBindings.ImportSource(txtSourceID.Text.Trim(), txtSourceName.Text.Trim(), devDateRelease.Value.ToString(), devDataComplete.Value.ToString(), txtModelPerson.Text.Trim(), txtCheckPerson.Text.Trim(), txtFunInfo.Text.Trim(), Word, Dll, Code); DataBindings.UpdateSourceProject(txtSourceID.Text.Trim(),
Session[ " RefreshProjectID " ].ToString().Split( new char [] { ' , ' }, StringSplitOptions.RemoveEmptyEntries)); DataBindings.UpdateSourceKeyWord(txtSourceID.Text.Trim(),
txtKeyWord.Text.Split( new char [] { ' , ' }, StringSplitOptions.RemoveEmptyEntries)); Session[ " DTAllSource " ] = DataBindings.MergeAllSource(DataBindings.GetAllSource()); BindTable((DataTable)Session[ " DTAllSource " ]); devgvwData.CancelEdit(); e.Cancel = true ; Session[ " WordFile " ] = null ; Session[ " DllFile " ] = null ; Session[ " CodeFile " ] = null ; } protected void devgvwData_RowUpdating( object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { TextBox txtSourceID = (TextBox)devgvwData.FindEditFormTemplateControl( " txtSourceID " ); TextBox txtSourceName = (TextBox)devgvwData.FindEditFormTemplateControl( " txtSourceName " ); TextBox txtModelPerson = (TextBox)devgvwData.FindEditFormTemplateControl( " txtModelPerson " ); TextBox txtCheckPerson = (TextBox)devgvwData.FindEditFormTemplateControl( " txtCheckPerson " ); TextBox txtProject = (TextBox)devgvwData.FindEditFormTemplateControl( " txtProject " ); ASPxDateEdit devDateRelease = (ASPxDateEdit)devgvwData.FindEditFormTemplateControl( " devDateRelease " ); ASPxDateEdit devDataComplete = (ASPxDateEdit)devgvwData.FindEditFormTemplateControl( " devDataComplete " ); TextBox txtFunInfo = (TextBox)devgvwData.FindEditFormTemplateControl( " txtFunInfo " ); TextBox txtKeyWord = (TextBox)devgvwData.FindEditFormTemplateControl( " txtKeyWord " ); byte [] Word = null ; byte [] Dll = null ; byte [] Code = null ; if (Session[ " WordFile " ] != null ) Word = Session[ " WordFile " ] as byte []; if (Session[ " DllFile " ] != null ) Dll = Session[ " DllFile " ] as byte []; if (Session[ " CodeFile " ] != null ) Code = Session[ " CodeFile " ] as byte []; DataBindings.UpdateSource(txtSourceID.Text.Trim(), Session[ " SourceID " ].ToString().Trim(), txtSourceName.Text.Trim(), devDateRelease.Value.ToString(), devDataComplete.Value.ToString() , txtModelPerson.Text.Trim(), txtCheckPerson.Text.Trim(), txtFunInfo.Text.Trim(), Word, Dll, Code); if (Session[ " RefreshProjectID " ] != null ) { DataBindings.UpdateSourceProject(txtSourceID.Text.Trim(), Session[ " RefreshProjectID " ].ToString(). Split( new char [] { ' , ' }, StringSplitOptions.RemoveEmptyEntries)); } DataBindings.UpdateSourceKeyWord(txtSourceID.Text.Trim(), txtKeyWord.Text.Split( new char [] { ' , ' }, StringSplitOptions.RemoveEmptyEntries)); devgvwData.CancelEdit(); e.Cancel = true ; Session[ " DTAllSource " ] = DataBindings.MergeAllSource(DataBindings.GetAllSource()); BindTable((DataTable)Session[ " DTAllSource " ]); Session[ " WordFile " ] = null ; Session[ " DllFile " ] = null ; Session[ " CodeFile " ] = null ; } #region FileUpload protected void devUploadWord_FileUploadComplete( object sender, FileUploadCompleteEventArgs e) { Session[ " WordFile " ] = (sender as ASPxUploadControl).UploadedFiles[ 0 ].FileBytes; } protected void devUploadDll_FileUploadComplete( object sender, FileUploadCompleteEventArgs e) { Session[ " DllFile " ] = (sender as ASPxUploadControl).UploadedFiles[ 0 ].FileBytes; } protected void devUploadCode_FileUploadComplete( object sender, FileUploadCompleteEventArgs e) { Session[ " CodeFile " ] = (sender as ASPxUploadControl).UploadedFiles[ 0 ].FileBytes; } #endregion protected void devgvwData_StartRowEditing( object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e) { devgvwData.JSProperties[ " cp_key " ] = e.EditingKeyValue.ToString().Trim(); // 记录键值 Session[ " SourceID " ] = e.EditingKeyValue.ToString().Trim(); Session[ " RefreshProjectID " ] = null ; } #region 点击出现详细信息 protected void devcbpnlProInfo_Callback( object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { GetMoreText( " lblProInfo " , e.Parameter.Trim(), " projectname " , devcbpnlProInfo); } protected void devcbpnlModel_Callback( object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { GetMoreText( " lblModel " , e.Parameter.Trim(), " modelname " , devcbpnlModel); } protected void devcbpnlBook_Callback( object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { GetMoreText( " lblBook " , e.Parameter.Trim(), " bookname " , devcbpnlBook); } protected void devcbpnlKeyWord_Callback( object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { GetMoreText( " lblKeyWord " , e.Parameter.Trim(), " keyword " , devcbpnlKeyWord); } protected void devcbpnlFunction_Callback( object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { GetMoreText( " lblFunction " , e.Parameter.Trim(), " funInfo " , devcbpnlFunction); } /// <summary> /// 获取更多信息 /// </summary> /// <param name="name"></param> /// <param name="keyword"></param> /// <param name="fieldword"></param> /// <param name="mypnl"></param> private void GetMoreText( string name, string keyword, string fieldword, ASPxCallbackPanel mypnl) { Label lbl = mypnl.FindControl(name) as Label; DataTable DTAllSource = (DataTable)Session[ " DTAllSource " ] as DataTable; DataRow[] DRSelfSource = DTAllSource.Select( " sourceid=' " + keyword + " ' " ); if (DRSelfSource.Length == 0 ) return ; lbl.Text = DRSelfSource[ 0 ][fieldword].ToString(); } #endregion protected void devgvwData_CustomJSProperties( object sender, ASPxGridViewClientJSPropertiesEventArgs e) { devgvwData.JSProperties[ " cp_index " ] = devgvwData.EditingRowVisibleIndex; } protected void trlProjcet_CustomCallback( object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e) { Session[ " ProjcetData " ] = MergeData(DataBindings.ShowProjcetOrg()); trlProjcet.DataSource = Session[ " ProjcetData " ] as DataTable; trlProjcet.DataBind(); } /// <summary> /// 合并生成treelist的工程分类数据集 /// </summary> /// <param name="DTOld"></param> /// <returns></returns> private DataTable MergeData(DataTable DTOld) { DataTable DTNew = new DataTable(); DTNew.Columns.Add( new DataColumn( " ParID " , typeof ( string ))); DTNew.Columns.Add( new DataColumn( " projectid " , typeof ( string ))); DTNew.Columns.Add( new DataColumn( " projectname " , typeof ( string ))); for ( int i = 0 ; i < DTOld.Rows.Count; i ++ ) { DataRow DR = DTNew.NewRow(); DR[ " projectid " ] = DTOld.Rows[i][ " projectid " ].ToString().Trim(); DR[ " projectname " ] = DTOld.Rows[i][ " projectname " ].ToString().Trim(); if (DTOld.Rows[i][ " projectid " ].ToString().Trim().Length == 2 ) { DR[ " ParID " ] = " 0 " ; } else { DR[ " ParID " ] = DTOld.Rows[i][ " projectid " ].ToString().Trim().Substring( 0 , DTOld.Rows[i][ " projectid " ]. ToString().Trim().Length - 2 ); } DTNew.Rows.Add(DR); } DTNew.AcceptChanges(); return DTNew; } protected void ASPxComboBox1_Callback( object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { Session[ " RefreshProjectID " ] = e.Parameter.Trim(); } }

运行效果:

数据展示

数据维护:

2.js数据校验层:

    
    
// ImoprtSourcePage var txtSourceID, txtSourceName, txtProject, txtKeyWord; function onProjectCategory(element, keyValue) { OnCloseAllPopPnl(); devpopupcProject.ShowAtElement(element); pnlProject.PerformCallback(keyValue); } function onKeyWordCategory(element, keyValue) { OnCloseAllPopPnl(); devpopupKeyWord.ShowAtElement(element); devcbpnlKeyWord.PerformCallback(keyValue); } function onModelCategory(element, keyValue) { OnCloseAllPopPnl(); devpopupModel.ShowAtElement(element); devcbpnlModel.PerformCallback(keyValue); } function OnFromCategory(element, keyValue) { OnCloseAllPopPnl(); devpopupBook.ShowAtElement(element); devcbpnlBook.PerformCallback(keyValue); } function OnFunctionCategory(element, keyValue) { OnCloseAllPopPnl(); devpopupFunction.ShowAtElement(element); devcbpnlFunction.PerformCallback(keyValue); } function OnCloseAllPopPnl() { devpopupcProject.Hide(); devpopupKeyWord.Hide(); devpopupModel.Hide(); devpopupBook.Hide(); devpopupFunction.Hide(); } function btnUpdate_onclick() { // devUploadWord.Upload();//Begin Upload File VerifyImportSource(); } function onWordCompleted(s, e) { lblWordSuccess.SetVisible( true ); } function onDllCompleted(s, e) { lblDllSuccess.SetVisible( true ); } function onCodeCompleted(s, e) { lblCodeSuccess.SetVisible( true ); } // 校验更新数据 function VerifyImportSource() { var index = grid.cp_index; if (index < 0 ) { txtSourceID = $get( " devgvwData$DXPEForm$efnew$txtSourceID " ); txtSourceName = $get( " devgvwData$DXPEForm$efnew$txtSourceName " ); } else { txtSourceID = $get( " devgvwData$DXPEForm$ef " + index + " $txtSourceID " ); txtSourceName = $get( " devgvwData$DXPEForm$ef " + index + " $txtSourceName " ); } if (txtSourceID.value.trim() == '' ) { alert( ' 资源ID不允许为空 ' ); txtSourceID.focus(); return ; } if (txtSourceName.value.trim() == '' ) { alert( ' 资源名称不允许为空 ' ); txtSourceName.focus(); return ; } if (grid.cp_key.trim() == '' || grid.cp_key.trim() != txtSourceID.value.trim()) { ImportSourceService.CheckSourceID(txtSourceID.value.trim(), onSuccessed); // 调用webservice } else { grid.UpdateEdit(); } } function onSuccessed(result) { if ( ! result) { alert( ' 该资源ID已经存在,请重新输入 ' ); txtSourceID.focus(); return ; } else { grid.UpdateEdit(); // Begin Update } } function btnSelectProjcet_Click(element) { devpopupAllProjcet.ShowAtElement(element); trlProjcet.PerformCallback(); } // 保存工程分类 function btnSaveProject_Click() { var arrproject = new Array( " projectid " , " projectname " ); trlProjcet.GetSelectedNodeValues(arrproject, GetSelectedValuesCallback); } // 获取选择的工程分类 function GetSelectedValuesCallback(values) { var id = '' ; var name = '' ; for ( var i = 0 ; i < values.length; i ++ ) { id += values[i][ 0 ] + ' , ' ; name += values[i][ 1 ] + ' , ' ; } var index = grid.cp_index; if (index < 0 ) { txtProject = $get( " devgvwData$DXPEForm$efnew$txtProject " ); } else { txtProject = $get( " devgvwData$DXPEForm$ef " + index + " $txtProject " ); } txtProject.value = name; txtProjectID.PerformCallback(id); devpopupAllProjcet.Hide(); } function onKeyWordBlur() { var index = grid.cp_index; if (index < 0 ) { txtKeyWord = $get( " devgvwData$DXPEForm$efnew$txtKeyWord " ); } else { txtKeyWord = $get( " devgvwData$DXPEForm$ef " + index + " $txtKeyWord " ); } ReplaceIlllegal(txtKeyWord); } // 替换非法字符 function ReplaceIlllegal(textbox) { if (textbox.value.indexOf( ' ' ) != - 1 ) { textbox.value = textbox.value.replace( / \, / g, ' , ' ); } if (textbox.value.indexOf( ' | ' ) != - 1 ) { textbox.value = textbox.value.replace( / \| / g, ' , ' ); } if (textbox.value.indexOf( ' ' ) != - 1 ) { textbox.value = textbox.value.replace( / \、 / g, ' , ' ); } } if ( typeof (Sys) !== ' undefined ' ) Sys.Application.notifyScriptLoaded();
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值