
ASP.NET
文章平均质量分 58
littlekeen
这个作者很懒,什么都没留下…
展开
-
学习新事物:使用jquery+xml实现ajax简单实例
调用页面通过事件触发对应函数,使用ajax的方式调用上面页面得到数据集,并差找出对应记录 function OnAgentCityChange(){ var city = $("#").val(); $.ajax( { url: /Order/Report/XML/GetCompanyByCity.aspx?City=原创 2008-10-09 15:49:00 · 1369 阅读 · 0 评论 -
JS:Trim() in javascript, how to define a function of checkinput for a WebControl(ascx)
//去除字符串两端空格,用法是string.Trim()String.prototype.Trim = function(){ return this.replace(/(^/s*)|(/s*$)/g, "");}function CheckInput(){ //验证名称 document.Form1.AddMessage1_MessageTitle.value == document.For原创 2005-10-13 13:30:00 · 2169 阅读 · 0 评论 -
How To get the Real length of a string with chinese words
1 一个汉字长度是2,是指它的字节数是2,如:"a12你好",字符串的字节数为7,字符串的长度为5,调用系统的Length=5,说明Length只对字符不对字节进行查询; public int GetLength(string inputString) { return System.Text.Encoding.Default.GetByteCount(inputString.Trim(原创 2005-10-26 17:28:00 · 1152 阅读 · 0 评论 -
Session:"数据无法验证的错误"
1 Session有效期Session在IE中: 有效的窗品包括 1.Session对象只在建立Session对象的窗口中有效。 2.在建立Session对象的窗口中新开链接的窗口 无效的窗口包括 1.直接启动IE浏览器的窗口 2.不是在建立Session对象的窗口中新开链接的窗口2 解决方式1这种情况是因为会话状态(包括SESSION、VIEWSTATE原创 2005-10-19 11:34:00 · 3945 阅读 · 0 评论 -
using webdiyer:AspNetPager(AspNetPager.dll)
1 add the control in aspx page: HorizontalAlign="center">说明: ShowInputBox 可以出现输入框,指定跳转页面;2 .csDataSet ds = brPager.LoadList(pager,ref allcount);//allcount 用于接收记录总数if(dt.Rows.Count原创 2005-10-17 14:47:00 · 2833 阅读 · 0 评论 -
JS:only number(int ,float) can be input
//只能输入数字function CheckInputIsInt(keyCode){ if((keyCode>95 && keyCode || (keyCode>47 && keyCode || keyCode == 8 || keyCode == 46 || keyCode == 37 || keyCode == 39 || keyCode == 9 || keyCode == 13) { }原创 2005-10-13 11:47:00 · 2304 阅读 · 6 评论 -
动态设置HyperLink的属性
for(int i=0;i { ((HyperLink)this.FindControl("HyperLink"+i)).Visible = true; ((HyperLink)this.FindControl("HyperLink"+i)).Text = ds.Tables[0].Rows[i]["ProductName"].ToString(); ((Hype原创 2005-10-10 15:54:00 · 1891 阅读 · 0 评论 -
正则表达式
匹配中文字符的正则表达式: [/u4e00-/u9fa5]匹配双字节字符(包括汉字在内):[^/x00-/xff]应用:计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)String.prototype.len=function(){return this.replace([^/x00-/xff]/g,"aa").length;}匹配空行的正则表达式:/n[/s| ]*原创 2005-10-13 12:03:00 · 3896 阅读 · 2 评论 -
using DataTable.Select()
private static void GetRowsByFilter(){ DataTable customerTable = new DataTable( "Customers" ); // Add columns customerTable.Columns.Add( "id", typeof(int) ); customerTable.Columns.A原创 2005-10-17 17:11:00 · 1645 阅读 · 0 评论 -
using JS to control two select(html),the data can be loaded from database and XML,and show in the select
1 存储 省市的xml文件add1code="1100,3100,1200,5000,4400,3200,3300,3700,3400,4100,1300,2100,3500,5100,4500,4300,4200,6100,5200,2200,3600,5300,1400,6500,6200,4600,6400,8100,5400,6300,7100,8200,2300,1500";add1na原创 2005-10-14 11:57:00 · 6127 阅读 · 0 评论 -
some functions
namespace SooFXX.Components{ using System; using System.Net; using System.Data; using System.Web; using System.IO; using System.Text; using System.Web.Caching; using System.Configuration; using System原创 2005-09-26 15:57:00 · 1291 阅读 · 0 评论 -
sqlhelper.cs
using System;using System.Data;using System.Xml;using System.Data.SqlClient;using System.Collections;using System.Configuration;namespace SooFan.SqlDataProvider{ public sealed class SqlHelper {原创 2005-09-26 14:53:00 · 1352 阅读 · 0 评论 -
System.Text.StringBuilder拼装table
//建立业务层对象 SooF.BusinessRules.Apeak.BRSchools brSchool =new SooF.BusinessRules.Apeak.BRSchools(); DataSet ds = brSchool.SingleShoolsDataSet(Province); if((ds.Tables.Count>0)&&(ds.Tables[0].原创 2005-09-26 13:58:00 · 1574 阅读 · 0 评论 -
using ItemCommand
//first add following delegate in the private void InitializeComponent()this.DataGrid1.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_ItemCommand);public voi原创 2005-09-16 09:30:00 · 904 阅读 · 0 评论 -
Function of NumToTelphoneString
public static string NumToTelphoneString(decimal phone) { Int64 telphone = Convert.ToInt64(phone) ; if (telphone == 0) return string.Empty ; str原创 2005-09-15 15:24:00 · 736 阅读 · 0 评论 -
How to fix the problem of " Session Lost "
感谢您使用微软产品。首先,请您确认这个问题是否是由于下面的文章描述的问题导致的:Q323752 PRB: Session Variables Are Lost If You Use FRAMESEThttp://support.microsoft.com/support/kb/articles/q323/7/52.asp然后,请您打开Web.config确认您正在使用的Session类型,是Inp原创 2005-09-15 14:57:00 · 985 阅读 · 0 评论 -
权限管理 how to control the authorization?
1、使用ASP.Net自带的权限管理 在web.config文件中修改以下的内容: 2.在login.aspx中如果用户名和密码正确则给予验证:FormsAuthentication.SetAuthCookie(TextBox_name.Text,false); //在本页 FormsAuthentication.RedirectFromLoginPage(TextBo原创 2005-11-01 16:45:00 · 1231 阅读 · 0 评论 -
固定表头的JS:How to fix a part of a table
--------------------------------------------------------------------------------------------------.FixedHeaderColumn {background-color: red; position:relative; left:expression(this.offsetParent.scro原创 2005-11-01 10:04:00 · 1232 阅读 · 0 评论 -
下载对话框消失导致Excel无法正常保存的故障
财务部的几个小姑娘一直反应,报表在导出时,没有保存和打开的提示对话框了,导致直接在页面打开文件,而且无法正常保存。分析后,发现是有两个方面的原因:1 人为的取消了提示框,这是个常见的操作;2 页面打开excel启动了excel进程,导致在打开excel以便复制再保存时,操作无法响应; 解决方法比较简单:工具--文件夹选项--文件类型 找到excel文件,高级,勾选“下载后原创 2008-09-19 10:58:00 · 1972 阅读 · 0 评论 -
MDM引起的VS项目无法正常调试
安装完“Microsoft 脚本编辑器”时,一个名为 Mdm.exe(“计算机调试管理器”,用于提供应用程序调试)的程序也将同时安装,结果就是这个东东让系统调试出了问题。提示信息为: 试图运行项目时出错:无法启动调试 没有正确安装调试器。请运行安装程序安装或修复调试器 1 regsvr32 mscordbi.dll 本地(win2003+VS2003)路径C:/WIND原创 2008-07-15 17:43:00 · 1695 阅读 · 1 评论 -
学习JSON:认识JSON+jayrock
JavaScript Object Notation(或 JSON),即一种开放式和基于文本的数据交换格式,它提供了一种标准数据交换格式,更适用于 Ajax 样式的 Web 应用程序。JSON: http://www.json.org/Jayrock是一个LGPL的开源的软件,实现了JSON和JSON-RPC,支持微软ASP.NET框架。JSON+Jayrock+ASP.NET Qui原创 2008-01-07 09:53:00 · 1145 阅读 · 0 评论 -
好好学习:如何取出设置diasable的dropdownlist的值
比较可行的办法有Request.Form["ddlXXList"] .如果是diasable,应该在提交前设置 disabled= false;不然返回的将是null原创 2007-12-19 14:16:00 · 757 阅读 · 0 评论 -
asp.net 时间比较
一般都是在数据库端做时间比较,但最近的开发中遇到需要在net 平台中做时间比较,有两种情况应该比较普遍,现将我的对应处理代码帖出如下:1 日期段有效性 比如“2007-8-10 日前有效”,之前时间均可进行某种操作 DateTime.Now.CompareTo(Convert.ToDateTime("2007-8-10")) 判断返回值是否大于0 即可 注意参数如果不是System原创 2007-05-23 15:54:00 · 5499 阅读 · 4 评论 -
TCP网络通信的简单例子
using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.Net;using System.Net.Sockets;using System.IO;using Syst原创 2007-05-12 14:59:00 · 1496 阅读 · 0 评论 -
UDP网络通信的简单例子
using System ;using System.Drawing ;using System.Collections ;using System.ComponentModel ;using System.Windows.Forms ;using System.Data ;using System.Net ;using System.Net.Sockets ;using System.Threa原创 2007-05-12 15:02:00 · 1815 阅读 · 0 评论 -
好好学习:VSS使用故障及解决(2)
打开VS,发现我想要的文件已经被签出,记得昨天我还在修改,没有签入啊? 带着问号,打开VSS,发现被一个带【机器名】的我签出,真是奇怪! 仔细拍脑袋一想,才明白过来,因为最近单位网络规范管理,对机器名做了统一,我也修改了机器名,没想到今天一开机系统就出这个问题。 找到原因很好解决了,将名称再改回去,一切正常。 其实最好的是,先把工程签入,原创 2007-08-09 18:59:00 · 3118 阅读 · 0 评论 -
GDI+屏幕截图程序
最近在整理以前的的开发资料,发现了过去开发过程中写的不少程序还比较有意思,特此一一整理,以备后用命名空间using System.Drawing.Imaging;using DCOMExtLib;using System.Runtime.InteropServices; 方法[DllImport("gdi32.dll")] private static extern IntPtr原创 2007-04-20 10:56:00 · 3155 阅读 · 2 评论 -
好好学习:学习MagicAjax(一)
先做好准备工作:把AjaxCallObject.js复制到虚拟目录下的script目录下(在配置信息中与此对应),项目中添加MagicAjax.dll(官网地址是:http://www.magicajax.net/)1,需要WEB.CONFIG中 加入配置信息 magicAjax outputCompareMode="HashCode"原创 2007-07-19 18:53:00 · 1654 阅读 · 2 评论 -
C#中调用Windows API时的数据类型对应关系
最近想做个截屏的小程序,必须用久违的api了,但发现原型函数的一些数据类型看起来非常费劲,就整理一下BOOL=System.Int32BOOLEAN=System.Int32BYTE=System.UInt16CHAR=System.Int16COLORREF=System.UInt32DWORD=System.UInt32DWORD32=System.UInt32DWORD64=System原创 2007-04-17 15:24:00 · 2452 阅读 · 2 评论 -
单一登录:Active Directory 联合身份验证服务开发简介
摘自 November 2006 期刊 MSDN Magazine. Active Directory 联合身份验证服务 (ADFS) 是 Windows Server® 2003 R2 最重要的组件之一。ADFS 能够解决很多问题,而其中最显而易见的就是企业到企业的自动化控制问题。在这篇文章中,我将从一个开发人员的角度来分析 ADFS,我们假设这个开发人员正在构建一个 Web 应用程序,而且转载 2007-04-13 11:34:00 · 9855 阅读 · 0 评论 -
Web Service服务 :在客户端将图片保存至图片服务器
1 建立服务asmx比较简单:上传的图片以Base64String参数形式传入注意: 这个转换是有损转换, 将Jpeg文件转换成Base64String, 再转换回来成Jpeg的文件明显小于原图(我在测试时发现是这样的.)using System;using System.Collections;using System.ComponentModel;using System.Data原创 2007-03-27 17:18:00 · 5848 阅读 · 2 评论 -
解决下载文件名乱码问题的简单方法
string fileName="中文.xls";string filePath = @"/UpLoad/Reports"FileInfo file = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(filePath)+fileName); Response.Charset = "utf-8"; Respons原创 2006-11-24 13:01:00 · 6418 阅读 · 0 评论 -
将datagrid数据导入到excel的方法
方法很简单,只是将DataGrid的内容输出到HtmlTextWriter流,再将流作为附件让用户下载或者用Excel打开.此方法虽然简单,但能实现功能.private void button_OutExcel_Click(object sender, System.EventArgs e) { Response.Clear(); Response.Buffer= tru原创 2006-06-15 13:15:00 · 1608 阅读 · 0 评论 -
define a static method to convert datatime to a formatted string with uesr-defined
public static string DateToString( DateTime dt , string splitter ) { string sTemp = String.Empty; if(dt.Month { sTemp += "0"; } sTemp += dt.Month.ToString(); sTemp += splitter; i原创 2005-09-20 10:46:00 · 1246 阅读 · 0 评论 -
Implement the functions as ICollection.Sort() and ICollection.Compare()
using System;using System.Reflection ;using System.Collections ;namespace SystemFramwork.Tools{ /// /// SystemTool 的摘要说明。 /// public sealed class AutoArrayComparer : System.Collections.IComparer原创 2005-09-15 15:46:00 · 1180 阅读 · 0 评论 -
Move the Item of ListBox
.aspx-------------------------------- a1 a2 a3 ----------------------------------.cs//for 个private void Button1_Click(object sender, System.EventArgs e){ if (this.ListBox1.SelectedIndex>=原创 2005-09-07 16:13:00 · 1719 阅读 · 0 评论 -
c#中如何判断已知网络的连接状态?(2)
string strServerIp="192.168.0.45";//为主机IP地址int iDataPort=80;Socket clientSocket =new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);bool bResult=clientSocket.Connect(new IPEndPo原创 2005-09-01 10:18:00 · 1585 阅读 · 0 评论 -
c#中如何判断已知网络的连接状态?
下面的示例连接到远程终结点,然后验证该连接。[C#] aSocket.Connect(anEndPoint);if (!aSocket.Connected) { Console.WriteLine("Winsock error: " + Convert.ToString(System.Runtime.InteropServices.Marshal.GetLastWin32Error(原创 2005-09-01 10:15:00 · 1371 阅读 · 0 评论 -
JS:control the IE (40)
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键no 可用于Table2. 取消选取、防止复制3. onpaste="return false" 不准粘贴4. oncopy="return false;" oncut="return false;" 防止复制5. IE地址栏前换成自己的图标6. 可以在收藏夹中显示出你的图标原创 2005-08-18 11:43:00 · 747 阅读 · 0 评论 -
JS: How to control the IE(keyDown...)?
1 >屏蔽功能类1.1 屏蔽键盘所有键function document.onkeydown(){event.keyCode = 0;event.returnvalue = false;}-->1.2 屏蔽鼠标右键在body标签里加上oncontextmenu=self.event.returnvalue=false或者function document.oncontextmenu() { ret原创 2005-08-17 17:21:00 · 1362 阅读 · 0 评论