首页 > > > .net网站生成的时候出现未能加载类型
可是在项目中明明有这个文件的,
BountyUserAdd.aspx这个文件的代码如下:
<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation ="false" CodeBehind="BountyUserAdd.aspx.cs" Inherits="PatReview.Bounty.BountyUserAdd" %>
<%@ Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
<%@ Register TagPrefix="cc1" Namespace="PatReview.BLL" Assembly="PatReview.BLL" %>
<!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>
<base target="_self">
<title>奖金人员</title>
<link href="../css/systemmain.css" rel="stylesheet" type="text/css"/>
<link href="../css/gridStyle.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE3 {color: #FF0000}
a:link {
font-size: 12px;
color: #000000;
text-decoration: none;
}
a:visited {
font-size: 12px;
color: #000000;
text-decoration: none;
}
-->
</style>
<script language="javascript" type="text/javascript">
//给tree加选中时的状态
var lastnode = "";
var nodeValue="0";
function SetNode(node)
{
document.getElementById(node).style.backgroundColor='#808080';
document.getElementById(node).style.color='#F1F5F6';
var pos=node.indexOf("_");
nodeValue=node.substring(pos+1);
window.document.node=node;
window.document.getElementById("HidDepartmentCode").value=nodeValue;
if(lastnode!="" && lastnode!=node)
{
if (document.getElementById(lastnode) != null && document.getElementById(lastnode) != undefined)
{
document.getElementById(lastnode).style.backgroundColor='';// '#F1F5F6';
document.getElementById(lastnode).style.color='';
}
}
lastnode=node;
}
function setLastSelect()//如果在同样节点上连续添加,记住用户上次的选择
{
if(window.document.getElementById("HidDepartmentCode").value!="")
{
lastnode="spnode_"+window.document.getElementById("HidDepartmentCode").value;//如果用户未选择,默认选中根节点
}
else
{
lastnode="spnode_0"
}
SetNode(lastnode);
}
function DepatmentAdd()
{
window.opener.window.document.getElementById("TxtStaff").value = document.getElementById("getAllModuleID").value;
window.opener.window.document.getElementById("TxtStaff2").value = document.getElementById("getAllModuleName").value;
window.close();
}
function selectCheckBox()
{
var allCheckBox=document.getElementsByName("ResultList");
var i;
var allProjectID="";
var t=0;
var openHref;
var str ="";
for(i=0;i<allCheckBox.length;i++)
{
if(allCheckBox[i].checked==true)
{
allProjectID+=allCheckBox[i].value;
allProjectID+=",";
t++;
var gridItem = Grid1.Table.GetRow(i);
var id=gridItem.Cells[4].Value;
str+=""+id +",";
}
}
if(t<0)
allProjectID="";
var Idlength = allProjectID.length;
var NewId = allProjectID.substring(0,Idlength-1);
var strlength = str.length;
var NewStr = str.substring(0,strlength-1);
document.getElementById("getAllModuleID").value=NewId;
document.getElementById("getAllModuleName").value=NewStr;
}
function checkRorC()
{
var comefrom=window.location.href;
var gridItem;
var itemIndex = 0;
var str="";
var npublishcount=0;
var getStr=document.getElementById("getAllModuleID").value;
if(getStr==null||getStr=="")
{
alert('<%=PatReview.BLL.ResourceManager.GetString("SystemSet_SelectUser") %>');
return false;
}
}
</script>
</head>
<body onload="setLastSelect();">
<form id="Form1" runat="server">
<div style="display:none;">
<asp:TextBox ID="getAllModuleID" runat="server"></asp:TextBox>
<asp:TextBox ID="getAllModuleName" runat="server"></asp:TextBox>
<asp:TextBox ID="TxtSort" runat="server"></asp:TextBox>
</div>
<div style="height:6px; width:100%; overflow:hidden;"><img src="../images/top/spacer.gif" width="1" height="6" /></div>
<div style="MARGIN: 0px auto; WIDTH: 800px;">
<div class="publicboxleft"><img src="../images/ico/selftype.gif" width="37" height="34" /></div>
<div style="WIDTH: 753px;height:34px;float:left;">
<div style="WIDTH: 753px;height:34px;float:left;background-image: url(../images/search/exsearchmidbj.gif);font-size: 12px;line-height: 34px;color: #FFFFFF;text-decoration: none;"><%=PatReview.BLL.ResourceManager.GetString("Employee_List")%></div>
</div><div class="publicboxright"></div>
<br/>
<div style="WIDTH: 798px;height:350px;float:left;border: 1px solid #3D90C2; ">
<!--文本输入布局结束-->
<div style="width:200px; height:350px;; overflow:hidden; float:left; border-right:1px solid #0E9CCB;">
<div style="height:3px; width:100%; overflow:hidden;"><img src="../images/top/spacer.gif" width="1" height="3" /></div>
<div style="height:20px; width:100%; overflow:hidden;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"><img src="../images/ico/taleft.gif" width="28" height="18" /></td>
<td background="../images/ico/tabj.gif" class="font12bai"><%=PatReview.BLL.ResourceManager.GetString("Department_Select")%></td>
<td width="27" align="right"><img src="../images/ico/taright.gif" width="27" height="18" /></td>
</tr>
</table>
</div>
<div style="overflow:auto; width:200px; height:327px;">
<asp:TreeView ID="DepartmentTree" runat="server" ShowLines="True" Width="100%" CssClass="font12hei" >
</asp:TreeView>
</div>
</div>
<div style="width:596px; height:350px; overflow-y:auto; overflow-x:hidden; float:left;">
<div style="height:3px; width:100%; margin:0px auto; overflow:hidden;"><img src="../images/top/spacer.gif" width="1" height="3" /></div>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="4" align="left" bgcolor="#EEF1F8"><img src="../images/ico/kleft.gif" width="4" height="40" /></td>
<td background="../images/ico/kbj.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="149" height="26" align="right">
<%=PatReview.BLL.ResourceManager.GetString("Employee_EmployeeCodeName")%>
<!--员工编号或姓名--></td>
<td width="285"><asp:TextBox ID="TxtEmployeeName" class="searchbox" style="width:276px;" MaxLength="30" runat="server"></asp:TextBox></td>
<td width="148"><asp:Button ID="SearchButton" OnClick="Search_Click" runat="server" CssClass="buttonbj" /></td>
</tr>
</table></td>
<td width="4" align="right" bgcolor="#EEF1F8"><img src="../images/ico/kright.gif" width="4" height="40" /></td>
</tr>
</table>
<div style="height:3px; width:100%; margin:0px auto; overflow:hidden;"><img src="../images/top/spacer.gif" width="1" height="3" /></div>
<div style="width:98%; height:76%;margin:0px auto; overflow:hidden; overflow-y:scroll;">
<asp:HiddenField ID="HidDepartmentCode" runat="server" />
<ComponentArt:Grid id="Grid1"
CssClass="Grid"
EditOnClickSelectedItem="false"
AutoPostBackOnSelect="false"
width="100%" Height="" RunningMode="Server" ImagesBaseUrl="../images/grid"
runat="server" ShowFooter="False" SliderFetchDelay="0" SliderWidth="0"
CallbackCacheSize="10000" GroupingPageSize="10000" PageSize="10000">
<Levels>
<ComponentArt:GridLevel
DataKeyField="EmployeeCode"
AlternatingRowCssClass="AlternatingRow"
HeadingCellCssClass="HeadingCell"
HeadingRowCssClass="HeadingRow"
HeadingTextCssClass="HeadingCellText"
DataCellCssClass="DataCell"
SortAscendingImageUrl="asc.gif"
SortDescendingImageUrl="desc.gif"
>
<Columns>
<ComponentArt:GridColumn HeadingText="选择" AllowEditing="False" AllowSorting="False" DataCellServerTemplateId="SelectTemplates" Width="50" Align="Center" />
<ComponentArt:GridColumn HeadingText="编号" DataCellServerTemplateId="NumTemplates" AllowSorting="False" Width="60" Align="Center" />
<ComponentArt:GridColumn HeadingText="员工编号" DataField="EmployeeCode" Width="120" />
<ComponentArt:GridColumn HeadingText="用户名" DataField="UserCode" Width="120" />
<ComponentArt:GridColumn HeadingText="姓名" DataField="EmployeeName" Width="120"/>
</Columns>
</ComponentArt:GridLevel>
</Levels>
<ServerTemplates>
<ComponentArt:GridServerTemplate Id="NumTemplates">
<Template>
<%# Daweisoft.Utility.DataConvert.ObjectToInt(Container.ID.ToString().Substring(10)) + 1%>
</Template>
</ComponentArt:GridServerTemplate>
<ComponentArt:GridServerTemplate Id="SelectTemplates">
<Template>
<input type="checkbox" name="ResultList" onclick="selectCheckBox();" id="ResultList" value="<%# Container.DataItem["EmployeeCode"] %>" />
</Template>
</ComponentArt:GridServerTemplate>
</ServerTemplates>
</ComponentArt:Grid>
</div>
<div style="height:3px; width:100%; overflow:hidden;"><img src="../images/top/spacer.gif" width="1" height="3" /></div>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" class="GridViewPagerStyle">
<tr>
<td height="30" align="center">
<cc1:pager id="Pager1" runat="server" onpagechanged="Pager1_PageChanged"></cc1:pager>
</td>
</tr>
</table>
</div>
</div>
<div style="height:4px; width:100%; float:left; overflow:hidden;"><img src="../images/top/spacer.gif" width="1" height="3" /></div><div style="height:30px; width:798px; border: 1px solid #3D90C2;float:left;overflow:hidden; text-align:center;">
<div style="height:4px; width:100%; overflow:hidden; "><img src="../images/top/spacer.gif" width="1" height="3" /></div>
<asp:Button ID="But_Save" CssClass="buttonbj" runat="server" OnClientClick="return checkRorC();" onclick="But_Save_Click" />
<input type="submit" onclick="javascript:window.close();" class="buttonbj" name="Submit" value="<%=PatReview.BLL.ResourceManager.GetString("Close_Window")%>" />
</div>
</div>
</form>
</body>
</html>
BountyUserAdd.aspx.cs文件的代码如下:
复制代码
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using PatReview.BLL;
using Daweisoft.Utility;
using Daweisoft.ExceptionLog;
using System.Xml;
using PatReview.BLL.Patent;
namespace PatReview.Bounty
{
public partial class BountyUserAdd : PageBase
{
protected void Page_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException)
{
Server.Transfer("../Msg/JSErrorClose.aspx");
Server.ClearError(); // 如果不ClearError()这个异常会继续传到Application_Error()。
}
}
protected override void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
But_Save.Text = ResourceManager.GetString("SubmitSpace");
SearchButton.Text = ResourceManager.GetString("SearchSpace");
//加载部门树
UserAddInfo LoadTree = new UserAddInfo();
LoadTree.LoadDepartMentTree(DepartmentTree, "", 1);
GridViewDataBind(0);
if (Request.Params["DepartmentCode"] != null)
HidDepartmentCode.Value = Request.Params["DepartmentCode"].ToString();
}
Response.Expires = -1;
}
/// <summary>
/// 绑定数据
/// </summary>
/// <param name="CurPage"></param>
private void GridViewDataBind(int CurPage)
{
string StrSort = "";
if (TxtSort.Text == "")
{
StrSort = "EmployeeCode DESC";
}
else
{
StrSort = TxtSort.Text;
}
string sWhere = GetWhere();
int Total = 0;
UserAddInfo rml = new UserAddInfo();
DataTable dt = rml.GetUserList(sWhere, this.Pager1.PageSize, CurPage, StrSort, ref Total);
Pager1.RecTotal = Total;
Pager1.DataBind();
Grid1.DataSource = dt;
Grid1.DataBind();
}
/// <summary>
/// 检索条件
/// </summary>
/// <returns></returns>
private string GetWhere()
{
DataSet BountySpecialUser = (DataSet)SessionGlobal.Get().GetObject("BountySpecial");
DataView ddv = new DataView(BountySpecialUser.Tables["TP_PatentBountyDetail"], "", "BountySeqNo", DataViewRowState.CurrentRows);
string IDGroup = "";
for (int i = 0; i < ddv.Count; i++)
{
IDGroup += "'" + ddv[i]["BountyEmployee"] + "'" + ",";
}
if (ddv.Count != 0)
{
IDGroup = IDGroup.Substring(0, IDGroup.Length - 2);
IDGroup = IDGroup.Substring(1);
}
string sWhere = " (1=1) and";
if (IDGroup != "")
{
sWhere += " (EmployeeCode not in ('" + IDGroup + "')) and";
}
if (!string.IsNullOrEmpty(Request.Params["DepartmentCode"]))
{
sWhere += " (DepartmentCode = '" + Request.Params["DepartmentCode"] + "') and";
}
if (TxtEmployeeName.Text != "")
{
sWhere += " (EmployeeName like '%" + StringEx.Replace(TxtEmployeeName.Text) + "%' or EmployeeCode like '%" + StringEx.Replace(TxtEmployeeName.Text) + "%')and";
}
sWhere = sWhere.Substring(0, sWhere.Length - 3);
return sWhere;
}
protected void Search_Click(object sender, EventArgs e)
{
GridViewDataBind(0);
}
protected void Pager1_PageChanged(object sender, EventArgs e)
{
GridViewDataBind(Pager1.CurPage); //得到当前页记录集绑定到DataGird表上
}
protected void But_Save_Click(object sender, EventArgs e)
{
string item = getAllModuleID.Text;
string MngNo = Request.Params["MngNo"];
if (item == null)
{
return;
}
string[] idArr = item.Split(',');
for (int i = 0; i < idArr.Length; i++)
{
string id = idArr[i].ToString();
string StrEmployeeName = "";
string StrDepartmentName = "";
//读出此用户的相关信息(用户名,部门名称)
Employee GetInfo = new Employee();
DataSet ds = GetInfo.GetEmployeeInfo(id);
DataTable dt = ds.Tables[0];
StrEmployeeName = dt.Rows[0]["EmployeeName"].ToString();
//在这INSERT进内存
if (SessionGlobal.Get().GetObject("BountySpecial") == null)
return;
DataSet BountySpecialUser = (DataSet)SessionGlobal.Get().GetObject("BountySpecial");
DataRow row = BountySpecialUser.Tables["TP_PatentBountyDetail"].NewRow();
row["BountyEmployee"] = id;
row["BountyEmployeeName"] = StrEmployeeName;
row["BountySeqNo"] = DataConvert.ObjectToInt(BountySpecialUser.Tables["TP_PatentBountyDetail"].Compute("Max(BountySeqNo)", "")) + 1;
row["ManagerNo"] = "特殊奖金";
//row["BountyType"] = "EEE";
row["BountyEmpPayState"] = "01";
row["Checked"] = true;
//row["BountyYear"] = DateTime.Now.Year;
row.EndEdit();
BountySpecialUser.Tables["TP_PatentBountyDetail"].Rows.Add(row);
SessionGlobal.Get().AddObject("BountySpecial", BountySpecialUser);
}
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "window.close();", true);
}
#region 列表排序
public void OnPageIndexChanged(object sender, ComponentArt.Web.UI.GridPageIndexChangedEventArgs args)
{
Grid1.CurrentPageIndex = args.NewIndex;
}
public void OnSort(object sender, ComponentArt.Web.UI.GridSortCommandEventArgs args)
{
TxtSort.Text = args.SortExpression;
}
public void OnNeedDataSource(object sender, EventArgs oArgs)
{
GridViewDataBind(0);
}
public void OnNeedRebind(object sender, System.EventArgs oArgs)
{
Grid1.DataBind();
}
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
//this.Load += new System.EventHandler(this.Page_Load);
Grid1.PageIndexChanged += new ComponentArt.Web.UI.Grid.PageIndexChangedEventHandler(OnPageIndexChanged);
Grid1.SortCommand += new ComponentArt.Web.UI.Grid.SortCommandEventHandler(OnSort);
Grid1.NeedRebind += new ComponentArt.Web.UI.Grid.NeedRebindEventHandler(OnNeedRebind);
Grid1.NeedDataSource += new ComponentArt.Web.UI.Grid.NeedDataSourceEventHandler(OnNeedDataSource);
}
#endregion
}
}来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1868/viewspace-3142888/ ,如需转载,请注明出处,否则将追究法律责任。