dof 版主您好,非常感谢您,
我的后台代码:
Grid1.ActiveSheetView.ColumnHeader.Cells[0, (int)Colk.申请单号].ColumnSpan = 2;
Grid1.ActiveSheetView.Columns[(int)Colk.申请按钮].Width = 20;
FarPoint.Web.Spread.ButtonCellType btn2 = new FarPoint.Web.Spread.ButtonCellType();
btn2.Text = "...";
btn2.CommandName = "AppBtn";
btn2.OnClientClick = "return ShowApplyCode(this);";
Grid1.ActiveSheetView.Columns[(int)Colk.申请按钮].CellType = btn2;
我在fpspread初始化的时候,生成的 buttoncelltype,并且加了客户端事件
前台javascript
function ShowApplyCode(obj2) {
var sp = document.getElementById("Grid1"); //fpspread的id
var perid = document.getElementById("txtPerId").value;
var cfeeitem = document.getElementById("txtSHJJLID").value;
var obj = window.showModalDialog("../Common/CommApplyList.aspx?CFEEITEMCODE=" + cfeeitem + "&CDEPCODE=" + document.all("hidDepId").value + "&CPERCODE=" + perid, "view");
if (obj == undefined) {
return false;
}
var arrInfo;
if (obj.length > 0) {
arrInfo = obj.split("⊥");
if (arrInfo.length > 1) {
sp.SetValue(sp.ActiveRow, 6, arrInfo[1],true);
sp.SetValue(sp.ActiveRow, 20, arrInfo[0],true);
sp.Cells(sp.ActiveRow, 6).title = arrInfo[0];
sp.UpdatePostbackData();
}
}
return false;
}
在JS中调用弹出界面,并且返回值对fpspread单元格进行赋值。
版主请多多指教,我是刚研究这个。 |