摘要: 异常提示如下: MicrosoftOfficeExcel不能访问文件“*.xls”。可能的原因有: 1文件名称或路径不存在。 2文件正被其他程序使用。 3您正要保存的工作簿与当前打开的工作簿同名。莫名的错误,在本机调试一切正常,可是一旦部署到服务器,就无法访问了……查了些资料,看到大家都碰到这个问题解决方案即在C:\Windows\System32\config\systemprofile和C:\Windows\SysWOW64\config\systemprofile目录下创建名为Desktop目录即可解决问题对于COM组件无法访问的问题解决办法:1.1).通过webcon... 阅读全文
posted @ 2013-06-22 15:38 stevejson 阅读(1198) 评论(0) 推荐(0) 编辑
摘要: protected void sgvFile1_RowDataBound(object sender, GridViewRowEventArgs e){ DropDownList ddlAM = ((DropDownList)e.Row.FindControl("ddlAM")); ddlAM.SelectedIndexChanged += new EventHandler(ddlAM_SelectedIndexChanged); ddlAM.SelectedIndex = -1; ddlAM.Items.FindByValue(labAM.Text).Selecte... 阅读全文
posted @ 2013-06-21 08:55 stevejson 阅读(718) 评论(0) 推荐(0) 编辑
摘要: Dictionary<string, string> dic = GetRoleDescriptions(); string key = dic.FirstOrDefault(x => x.Value == ddlSearchRoleDes.SelectedItem.Text.Trim().ToUpper()).Key; 阅读全文
posted @ 2013-06-20 22:58 stevejson 阅读(554) 评论(0) 推荐(0) 编辑
摘要: 前台界面: <asp:GridView ID="GridView1" runat="server" Width="100%" CellPadding="4" ForeColor="#333333" AutoGenerateColumns="False" AllowPaging="True" PageSize="12" OnRowCancelingEdit="GridView1_RowCancelingEdit" 阅读全文
posted @ 2013-06-20 22:56 stevejson 阅读(333) 评论(0) 推荐(0) 编辑
摘要: 本代码实现思路是:页面显示和导出分开,导出的数据和用于页面显示的是同一查询数据方式,所以也是同样的数据,只是在导出数据时从数据库重新捞了一次数据。此导出数据方式会先将数据保存到Excel中,然后将创建的Excel文件保存到服务器指定位置,然后下载到客户端,下载完后立即删除掉刚在服务器上创建的Excel文件。 // 导出按钮事件protected void btOutputData_Click(object sender, EventArgs e) { ExportExcel(GetPrintingData(ViewState["ssearchCondition"].ToSt 阅读全文
posted @ 2013-06-20 21:32 stevejson 阅读(1185) 评论(0) 推荐(0) 编辑
摘要: 将asp.net页面中的如下语句:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">改为:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">问题就解决了。原因是XHTML中对td的Height属性已经去除 阅读全文
posted @ 2013-06-17 15:33 stevejson 阅读(380) 评论(0) 推荐(0) 编辑
摘要: <script type="text/javascript"> var t function cleaData() { t = setTimeout(syc, 3000); } function syc() { document.getElementById("Label1").innerText = ""; cleart(t); }</script> 阅读全文
posted @ 2013-06-17 10:10 stevejson 阅读(395) 评论(0) 推荐(0) 编辑
摘要: <script type="text/javascript"> function selectItem() { document.getElementById("chklist").value = ""; var chblist = document.getElementsByName("chkItem"); if (chblist.length > 0) { var rtn = ""; for (var i = 0; i < chblist.lengt... 阅读全文
posted @ 2013-06-17 10:08 stevejson 阅读(408) 评论(0) 推荐(0) 编辑
摘要: 效果图: 代码:static int PageSize = 30; #region 分页部分代码 //*********************************** 数据分页 ******************************** protected void FirstPage_Click1(object sender, EventArgs e) { int RecordCount = GetRecordCount(ViewState["ssearchCondition"].ToString()); //获取记录条数 Data... 阅读全文
posted @ 2013-06-17 10:05 stevejson 阅读(574) 评论(0) 推荐(0) 编辑
摘要: private void BindDate(){tbApplyStartDate.Attributes.Add("onclick", "new Calendar().show(this)");tbApplyEndTime.Attributes.Add("onclick", "new Calendar().show(this)");tbOfficialStartTime.Attributes.Add("onclick", "new Calendar().show(this)") 阅读全文
posted @ 2013-06-17 09:59 stevejson 阅读(1172) 评论(0) 推荐(0) 编辑
摘要: DataView view = newDt.DefaultView;view.Sort = "Description asc,replyEnd desc";DataTable table2 = view.ToTable(); 阅读全文
posted @ 2013-06-17 09:49 stevejson 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 页面:<asp:Button ID="Button3" OnClientClick="javascript:editItem('AddUser.aspx',330,520)" runat="server" Text="修改" BackColor="#3399FF" ForeColor="White" BorderStyle="None" Height="22px" onclick="Button3_Cli 阅读全文
posted @ 2012-09-09 00:27 stevejson 阅读(283) 评论(0) 推荐(0) 编辑
摘要: JavaScript用iframe弹出子页面刷新父页面iframeJs代码 <script language=JavaScript> parent.location.reload(); </script> <script language=JavaScript> parent.location.reload();</script>弹出子页面Js代码 <script language=JavaScript> window.opener.location.reload(); </script> <script langu 阅读全文
posted @ 2012-09-08 08:29 stevejson 阅读(178) 评论(0) 推荐(0) 编辑
摘要: [转]ASP.NET(C#)常用代码30例1. 打开新的窗口并传送参数: 传送参数: response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>") 接收参数: string a = Request.QueryString("id"); string b = Request.QueryString("id1"); 2.为按钮添加对话框 Bu 阅读全文
posted @ 2012-09-05 22:52 stevejson 阅读(197) 评论(0) 推荐(0) 编辑
摘要: <asp:TemplateField> <ItemTemplate> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></ItemTemplate></asp:TemplateField> =============================================protected void Button1_Click(objec 阅读全文
posted @ 2012-09-05 22:40 stevejson 阅读(435) 评论(0) 推荐(0) 编辑
摘要: public static bool IsInt(string value) { return Regex.IsMatch(value, @"^[+-]?\d*$"); } 阅读全文
posted @ 2012-09-05 22:34 stevejson 阅读(397) 评论(0) 推荐(0) 编辑
摘要: //在iframe加载的窗体中,控制父窗体div隐藏,并调用父窗体按钮事件 Response.Write("<script>parent.document.all.SearchDiv.style.display='none';parent.document.all.BlackDiv.style.display='none';parent.document.all.BtnShow.click();</script>");//在iframe加载的窗体中,控制父窗体div隐藏 Response.Write("< 阅读全文
posted @ 2012-09-05 22:32 stevejson 阅读(224) 评论(0) 推荐(0) 编辑
摘要: <script language="javascript" type="text/javascript"> function ShowSearch1() { document.getElementById('Search1').style.display ="none"; document.getElementById('Search2').style.display ="block"; document.getElementById('Link1').s 阅读全文
posted @ 2012-09-05 21:45 stevejson 阅读(388) 评论(0) 推荐(0) 编辑
摘要: 绑定时直接设置 某列隐藏,会出错下面有两种方法,不仅可以隐藏,还仍然可以正常取值方法一: 在RowCreated事件中书写如下代码 void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[0].Visible = false; //如果想使第1列不可见,则将它的可见性设为false } ... 阅读全文
posted @ 2012-09-05 21:43 stevejson 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 1. 创建通用的分页存储过程,sql2000,传入 表名,返回的列,查询条件,排序条件 CREATE procedure sp_Public_List ( @TableName varchar(50), @Cols varchar(1000), @strWhere varchar(8000), @strOrder varchar(100), @startIndex int, @endIndex int, @docount bit) as set nocount on if(@docount=1) exec ('select count(*) from ' + @TableNam 阅读全文
posted @ 2012-09-05 20:18 stevejson 阅读(167) 评论(0) 推荐(0) 编辑