最新评论
Re:VSS的Invalid handle错误 .net小鸟 2010-10-19 11:53
难道每次开机都这样?
Re:简易二级联动 戴海江 2010-06-06 21:58
有个 bug 。HOHO
当再次 选择 “请选择所在省份”时,
会出现provinceCity is undefined
我认识你,冯岩的女徒弟。呵呵
Re:js获取页面url的方法 gguozhenqian 2010-05-25 18:04
听不错的。
Re:千万级分页存储过程 gguozhenqian 2010-05-25 18:03
不错~!
Re:抓取网页 冯岩 2010-01-07 09:36
@mangohappy
对的!agent同样可以通过程序来构建一个!完善的防止抓取应该是不存在的,所谓道高一尺魔高一仗。博主这里的方法可以简单的防止一些技术功底相对差一点的对手!
可以通过一个时间段内,同一IP请求的次数来进行限制!但这样必然会对系统的性能带来不好影响!
Re:小偷程序获取新闻标题及内容 威廉 2009-12-13 00:08
能否发个可执行的版本,邮箱 zhwhrb@gmail.com
Re:DataBinder绑定表达式 sunsun 2009-07-23 14:11
vs2008中的简写Eval(“id”)
re: 抓取网页 mangohappy 2009-06-05 17:54
防止抓取的方法一点也不起作用,agent是可以自行编程构建的
re: 简单的谈谈在js中用到的反射 温景良(Jason) 2009-04-29 18:40
学习
"但是private static 是私有的,不能在外部访问,只能通过静态方法调用,这样可以防止对变量的修改"
private static 定义的变理,可以用通过非静态方法调用,如:
private static String s;
String getS(){
return s;
}
外面的引用采用:new 该类().getS();即可得到其值
常用webservice网站 sun00 2009-02-17 16:53
re: 利用div弹出新页面 孙雅玲 2009-01-19 13:30
如果你要子页面关闭的时候要传个参数到父页面,目前我知道的方法,只有模态窗口可以!别的方式不行。
除非你的父页面是每隔几秒自动刷新一下。这样,随便你开个什么子页面,操作完成后父页面也能得到数据,因为他自动刷新。否则,只有模态窗口可以。
我说被淘态的意思是,现在像这样的模式开发很少,。一般用层,并不会打开一个子页面,然后再传值到父页面
当你的一个窗口是通过另外一个窗口上的链接打开的时候,你希望在这个窗口操作完了后,比如,你修改了用户资料。完成后,你希望关闭这个窗口的时候,刚才那个父窗口也能更新。这时候。如果父窗口不是自动刷新,那么你只有通过模态窗口操作。
re: 上传图片 图片预览 2009-01-13 11:19
<script language="javascript">
function showImg()
{
var file = "<img src='"+document.getElementById("File1").value+"'>";
file = file.replace("\\","").replace("file:","").replace("/","\\").replace(":",":\\");
document.getElementById("imgShow").innerHTML= "预览图片:"+file;
}
</script>
[date] >= CONVERT(varchar(10), getDate(),121)
getDate()得到当前时间精确到微秒,2008-08-12 15:00:02
但有时只需要精确到天,得到今天以后的数据,就用convert截取前10位,121类似中国时间,美国时间之类的
@wlq
当然还有,我这是通过jmail组件发的,你还可以用.net自带的发邮件的组件
re: datagrid 啊啊啊 2008-12-19 09:48
int id = int.Parse(Dg.DataKeys[e.Item.ItemIndex].ToString());
隐藏id,只有根据主键得到id
re: DropDownList 有待完善 孙雅玲 2008-12-18 17:37
for(int i =0;i <ds.Tables[0].Rows.Count;i++)
{
dropdownlist.Items.Add("ds.Tables[0].Rows[0]["相应的列"].Tostring());
}
re: 复制table,根据条件复制table sunnya 2008-12-09 16:03
void BindFund()
{
BindRepFundNewPro();
//基金热门专题
RepFundYc.DataSource = dp.GetEbooksByType(TopicType.Fund,5).Items;
RepFundYc.DataBind();
//基金聚焦
DataTable dt = dp.GetPageContent("N","hpfund1",-1,50);
if(dt.Rows.Count>0)
{
DataTable dt2 = dt.Clone();
for(int i=0;i<5;i++)
{
dt2.Rows.Add(dt.Rows[i].ItemArray);
}
RepFundJj.DataSource = dt2;
RepFundJj.DataBind();
}
}
re: 精妙SQL语句收集 孙雅玲 2008-12-05 13:43
需求:随机的在问题上添加表情
如何随机查询数据?
select top 19 * from autoqa order by newid()
随机查询出19条记录
每次改变添加表情数量之前都要更新以前添加的问题,不用先删除在查询
只需求更新
update autoqa set question=substring(question,0,charindex('<img',question))
update a set FileName= substring(FileName,charindex('/',FileName)+1,len(FileName))
不一定对,提供2个思路吧,substring和charindex,这些函数共以后灵活使用
re: datagrid sunny1 2008-11-24 09:38
限制repeater显示条数
绑定限制条数arr
//单身白领
arr = dp.GetPersonProjectss(0,1,6,1,out count).Items;
if(arr.Count > 6)
{
arr.RemoveRange(6,arr.Count - 6);
}
this.OtherTypeOneRpt.DataSource = arr;
this.OtherTypeOneRpt.DataBind();
re: datagrid sunny1 2008-11-24 09:35
控制绑定datagird显示行数
void BankCard()
{
DataTable dt = dp.GetPageContent("N","hpfinancing5",-1,50);
if(dt.Rows.Count>0)
{
DataTable dt2 = dt.Clone();
for(int i=0;i<9;i++)
{
dt2.Rows.Add(dt.Rows[i].ItemArray);
}
RepBankCard.DataSource = dt2;
RepBankCard.DataBind();
}
}
re: DataBinder绑定表达式 孙雅玲 2008-11-12 15:52
dg中显示长度截取
<asp:TemplateColumn HeaderText="问题"> <ItemTemplate>
<%#ShowQuestion(DataBinder.Eval(Container.DataItem,"Question"))%>
</ItemTemplate>
</asp:TemplateColumn>
/截取多余的问答长度
protected string ShowQuestion(object s)
{
return Components.Formater.GetSubString(s.ToString(),60,"……");
}
不要掉了<ItemTemplate>不然会报控件错误
学习第三方js得到id值的方法——$(id),统一简化操作
function $(id)
{
return document.getElementById(id);
}
fundName = Components.Formater.ClearHtml(fundName).Replace(" ","").Replace("\r\n","").Replace("\t","");
/// <summary>
/// 除去HTML
/// </summary>
/// <param name="strhtml"></param>
/// <returns></returns>
public static string ClearHtml(string strhtml)
{
string stroutput = strhtml;
Regex regex = new Regex(@"<[^>]+>|</[^>]+>");
stroutput = regex.Replace(stroutput, "");
return stroutput;
}
re: 动态查询 及 多条件判断优化方法 孙雅玲 2008-10-15 14:59
计算2个时间间隔的天数
if((name.ToLower()=="sunsun" || name.ToLower()=="eflylab" )&& begin!="")
{
DateTime dtime = DateTime.Now;
if(end.Length > 0)
{
dtime = Convert.ToDateTime(end);
}
TimeSpan ts = dtime - Convert.ToDateTime(begin);
num = ts.Days*2;
}
re: DataBinder绑定表达式 孙雅玲 2008-10-13 11:28
<a href='<%#Components.Tools.Utils.GetNewsHtmlPath(Convert.ToInt32(DataBinder.Eval(Container.DataItem,"ArtId")))%>' target=_blank>
<%# Formater.Intercept((DataBinder.Eval(Container.DataItem,"ArtTitle")).ToString(),39)%>
re: DataBinder绑定表达式 孙雅玲 2008-10-09 14:30
@孙雅玲
可联系查看文章“dategrid添加勾选模板列方法2种”
re: DataBinder绑定表达式 孙雅玲 2008-10-09 14:28
<%#State(DataBinder.Eval (Container, "DataItem.suState"))%>
调用方法,在我博客的其他文章绑定冻结与未冻结里用到这个了,这里state方法里的参数是object类型,后台要判断类型,亦可在这里做转换
<%#State(Convert.ToInt32(DataBinder.Eval (Container, "DataItem.suState")))%>
setTimeout和setInterval的语法相同。它们都有两个参数,一个是将要执行的代码字符串,还有一个是以毫秒为单位的时间间隔,当过了那个时间段之后就将执行那段代码。
不过这两个函数还是有区别的,setInterval在执行完一次代码之后,经过了那个固定的时间间隔,它还会自动重复执行代码,而setTimeout只执行一次那段代码。
setInterval(Marquee,speed);
调用这个函数实现滚动,onmouseover当鼠标移上去停止滚动clearInterval(MyMar),当鼠标移开又继续滚动MyMar = setInterval(Marquee,speed)
re: datagrid 孙雅玲 2008-10-07 17:04
//给ddl赋值
ListItem li = DDlTitle.Items.FindByValue(ShowType);
if(li!=null)
{
li.Selected = true;
}
re: datagrid 孙雅玲 2008-10-07 16:55
datagrid里使用DropDownList
-------------------------------------------
private void Dg_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
DropDownList ddlState = (DropDownList)e.Item.FindControl
("DDLState");
string state = ddlState.SelectedValue;
int ID = int.Parse(e.Item.Cells[0].Text);
QsqPageContent pc = new QsqPageContent();
pc.Id = ID;
pc.State = state;
pc.Update();
Dg.EditItemIndex = -1;
Bind();
}
DropDownList ddlState = (DropDownList)e.Item.FindControl("DDLState");
datagrid里使用DropDownList ,模板列更新状态
<asp:TemplateColumn HeaderText="状态">
<ItemTemplate>
<%#State(DataBinder.Eval(Container, "DataItem.State"))%>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList id="DDLState" runat="server" AutoPostBack="True" >
<asp:ListItem Value="0">普通</asp:ListItem>
<asp:ListItem Value="1">New</asp:ListItem>
<asp:ListItem Value="2">Hot</asp:ListItem>
<asp:ListItem Value="12">New and Hot</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
public string State(object state)
{
string s="";
if(state!=null)
{
s = Convert.ToString(state);
}
if(s=="0"||s=="")
{
s = "普通";
}
else if(s=="1")
{
s = "New";
}
else if(s=="2")
{
s = "Hot";
}
else if(s=="3")
{
s = "New and Hot";
}
return s;
}
这样写if else 使所有路径都有返回值
re: 还原数据库与收缩日志文件 xiaolong 2008-10-04 18:02
安装sql server 挂起问题
安装SQL Server 2000的操作系统是Windows 2000 Profession Edition,安装简体中文标准版。会提示该版本的操作系统不能安装服务器组件,只能安装SQL Server 2000个人版。于是退出,选择安装个人版。
却出现了新的错误:
“以前的某个程序安装已在安装计算机上创建挂起的文件操作。运行安装程序之前必须重新启动计算机。”
发现删除掉如下键值信息即可安装:
在运行窗口输入regedit,打开注册表编辑器,在HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager中找到PendingFileRenameOperations,删除该键值,关闭注册表编辑器。重新安装SQL Server 2000,哈哈,久违的安装界面终于浮出水面了。
re: dategrid 孙雅玲 2008-09-27 11:19
int intCount = this.ArticleList.Items.Count;
for(int i=0;i<intCount;i++)
{
int ID = Convert.ToInt32(this.ArticleList.DataKeys[i].ToString());
}
re: DataBinder绑定表达式 孙雅玲 2008-09-26 17:44
<span> <%# Components.Formater.FormatDateSmallMonthDay( (DateTime)DataBinder.Eval(Container.DataItem,"CreateDate"))%></span>
<li><a href='<%# DataBinder.Eval(Container.DataItem,"Url")%>'
title='<%#DataBinder.Eval(Container.DataItem,"Title")%>' target=_blank >
<%# Formater.Intercept(DataBinder.Eval(Container.DataItem,"Title").ToString(),32)%></a>
</li>
javaScript中的编码方法:
escape() 方法:
采用ISO Latin字符集对指定的字符串进行编码。所有的空格符、标点符号、特殊字符以及其他非ASCII字符都将被转化成%xx格式的字符编码(xx等于该字符在字符集表里面的编码的16进制数字)。比如,空格符对应的编码是%20。unescape方法与此相反。不会被此方法编码的字符: @ * / +
//
using Shell32;
//
string sFile=@"c:\\test1.bmp";
ShellClass sh = new ShellClass();
Folder dir = sh.NameSpace( Path.GetDirectoryName(sFile) );
FolderItem item = dir.ParseName( Path.GetFileName( sFile ) );
string det = dir.GetDetailsOf( item, i );
//i 说明
0 :文件名 text1.bmp
1 : 大小 141KB
2 :类型 bmp文件
3 :修改时间
4 :创建时间
5 :访问时间
26:分辨率 1461x855
27:水平像素 1461像素
28:垂直像素 855像素
private IList<string> GetDetailedFileInfo(string sFile)
{
IList<string> aReturn = new IList<string>() ;
if (sFile.Length > 0)
{
try
{
ShellClass sh = new ShellClass();
Folder dir = sh.NameSpace(Path.GetDirectoryName(sFile));
FolderItem item = dir.ParseName(Path.GetFileName(sFile));
string 作者 = dir.GetDetailsOf(item, 9);
string 标题 = dir.GetDetailsOf(item, 10);
string 主题 = dir.GetDetailsOf(item, 11);
aReturn.Add(作者);
aReturn.Add(标题);
aReturn.Add(主题);
}
catch (Exception ex)
{
throw (ex.Message);
}
}
return aReturn;
}
}
re: 动态条件查询及日期格式转换 sunny1 2008-09-10 14:14
private void Button1_Click(object sender, System.EventArgs e)
{
string begin = beginDateID.Value;
string end = beginDateID18.Value;
string name = Utils.inject(txtName.Text);
DataTable dt2 = dp.SelectSubjectPager(currentPage,1000000000,search,orderBy,1,out count,suState);
DataView dv = dt2.DefaultView;
dv.RowFilter = "NickName='"+name+"' and suCreateDate>='"+begin+"' and suCreateDate<='"+Convert.ToDateTime(end).AddDays(1)+"'";
Response.Write(dv.Count);
}
这里图片是在css中控制的,如果直接显示在页面就用根据id不同显示与隐藏不同图片
re: DataBinder绑定表达式 sunny1 2008-09-02 12:32
原本绑定浏览量<%#DataBinder.Eval(Container.DataItem,"viewCount")%>,在其基础上将浏览量×73倍<%#Convert.ToInt32(DataBinder.Eval(Container.DataItem,"viewCount"))*73%>
<%#...%>绑定表达式 <%=...%>绑定变量
<%DataBinder.Eval(Container.DataItem,"NewsID")%>
vs2005中可以省略为:<% Eval("NewsID")%>