17 Apr 2006

原来验证码可以租的哦

http://www.textdisguise.com/TextDisguise/default.aspx
提供webservice生成防止机器人的CAPTCHA Image
看样子挺贵的,不过Demo看起来很不错。

13 Apr 2006

一个非常Strong 的ListBox控件EasyList


用于开发人员工具箱的资源
提到的EasyListBox是一款功能非常强大的ListBox控件
功能嘛我不说了                                                                                                             
http://easylistbox.com/demoColumns.aspx体验一下那20几个demo就知道了

13 Apr 2006

一个非常Strong 的ListBox控件EasyList


用于开发人员工具箱的资源
提到的EasyListBox是一款功能非常强大的ListBox控件
功能嘛我不说了                                                                                                             
http://easylistbox.com/demoColumns.aspx体验一下那20几个demo就知道了

11 Apr 2006

Yetanotherforum 编辑表情后不立即更新

文件  FormatMsg.cs


方法iAddSmiles内


Code:
strTemp = strTemp.Replace(code.ToLower(),String.Format("<img src=\"{0}\" alt=\"{1}\" />",basePage.Smiley(Convert.ToString(row["Icon"])),basePage.Server.HtmlEncode(row["Emoticon"].ToString())));
调用了两次可能导致被转化成html后有乱码出现


在方法GetSmilies内
Code:
System.Web.HttpContext.Current.Cache.Insert("Smilies",dt,null,DateTime.Now.AddMinutes(60),TimeSpan.Zero);
加入缓存项的Key和更新/删除时移除缓存的Key不一致 导致编辑表情后不立即更新
DB.cs
Code:
System.Web.HttpContext.Current.Cache.Remove("Smiles");

11 Apr 2006

Yetanotherforum 编辑表情后不立即更新

文件  FormatMsg.cs


方法iAddSmiles内


Code:
strTemp = strTemp.Replace(code.ToLower(),String.Format("<img src=\"{0}\" alt=\"{1}\" />",basePage.Smiley(Convert.ToString(row["Icon"])),basePage.Server.HtmlEncode(row["Emoticon"].ToString())));
调用了两次可能导致被转化成html后有乱码出现


在方法GetSmilies内
Code:
System.Web.HttpContext.Current.Cache.Insert("Smilies",dt,null,DateTime.Now.AddMinutes(60),TimeSpan.Zero);
加入缓存项的Key和更新/删除时移除缓存的Key不一致 导致编辑表情后不立即更新
DB.cs
Code:
System.Web.HttpContext.Current.Cache.Remove("Smiles");

08 Apr 2006

两个DropDownList在Repeater、DataList、DataGrid内的连动和冒泡事件(BubbleEvent)

两个DropDownList在Repeater、DataList、DataGrid内的连动和冒泡事件(BubbleEvent)
        问题:
http://community.csdn.net/Expert/topic/4670/4670056.xml?temp=3.944033E-02
        刚看第一眼觉得在第一个DDL的SelectedIndexChanged事件内绑定第二个DDL就ok了,页面上写或者ItemDataBound内写事件挂接代码都可以。打开VS写测试却发现有点障碍哦,
在SelectedIndexChanged内要知道去绑定哪个行哪个列的DDL要费些周折
只有从DDL一级一级的向上找Parent最后找到DataGridItem,再利用其ItemIndex定位到行然后FindControl到要绑定的DDL,最终可以实现,好像比较累哦。
        随又想到DataGrid的ItemCommand事件,但发现WebControl内只有Button ImageButton LinkButtonCommandName属性和 CommandArgument属性,并可以将事件上浮(冒泡).DropDownList先天不足!真是郁闷~~~~~ 能不能自己改造呢?动手试试就知道了。

<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<!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" xml:lang="gb2312" lang="gb2312">
<head>
<title> ItemDataBoundGetColumnName </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="title" content="" />
<meta name="author" content="活靶子,Huobazi,www.AspxBoy.com" />
<meta name="subject" content="" />
<meta name="language" content="gb2312" />
<meta name="keywords" content="" />
<meta name="Copyright" content="www.AspxBoy.com" />
<meta name="robots" content="all" />

<script language="c#" runat="server">
void BindGrid()
{
        DataTable dt = new DataTable();
        DataRow dr;
        dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
        dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
        dt.Columns.Add(new DataColumn("DateTimeValue", typeof(DateTime)));
        dt.Columns.Add(new DataColumn("BoolValue", typeof(bool)));
        dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));
        for (int i = 0; i < 36; i++) {
            dr = dt.NewRow();
            dr[0] = i;
            dr[1] = "项 " + i.ToString();
            dr[2] = DateTime.Now;
            dr[3] = (i % 2 != 0) ? true : false;
            dr[4] = 1.23 * (i+1);
            dt.Rows.Add(dr);
        }
  dg.DataSource= dt;
  dg.DataBind();
}
void Page_Load(object o, EventArgs e)
{
     dg.PagerStyle.Mode = PagerMode.NumericPages;
     if(!IsPostBack)
     {
        BindGrid();
     }
}
 
void btnClick(object o , EventArgs e)
{
     Response.Write("页面回发,但是不执行ItemDataBound");
}
 
void PageChange(object o , DataGridPageChangedEventArgs e)
{
     dg.CurrentPageIndex = e.NewPageIndex;
     BindGrid();
}
void ItemDataBound(object o , DataGridItemEventArgs e)
{
     if(e.Item.ItemIndex > -1 )//必须
     {
          DataRowView drv = (DataRowView)e.Item.DataItem;
          for (int i=0; i<drv.Row.Table.Columns.Count ; i++)
          { 
            Response.Write(drv.Row.Table.Columns[i].ColumnName + "&nbsp;&nbsp;");
          }
     }
}
</script>

</head>
<body>
<form runat="server">
  <ASP:DataGrid id="dg" runat="server"      
   HeaderStyle-BackColor="#aaaadd"
   AutoGenerateColumns="true"
   AllowPaging="true"
   PageSize="6"
    OnItemDataBound="ItemDataBound"
    OnPageIndexChanged="PageChange"
  >
  </asp:DataGrid>
  </br>
   <asp:button id="btn" runat="server" onclick="btnClick" Text="我是按钮,按我一下"></asp:button>
在AutoGenerateColumns="false"使用绑定列或者模板列的时候只需要使用 

<font color="blut">YourDataGrid.Columns[编号].HeaderText</font> 去获取
  
</form>
</body>
</html>

http://www.aspxboy.com/Files/71/66/284.Aspx

 

08 Apr 2006

两个DropDownList在Repeater、DataList、DataGrid内的连动和冒泡事件(BubbleEvent)

两个DropDownList在Repeater、DataList、DataGrid内的连动和冒泡事件(BubbleEvent)
        问题:
http://community.csdn.net/Expert/topic/4670/4670056.xml?temp=3.944033E-02
        刚看第一眼觉得在第一个DDL的SelectedIndexChanged事件内绑定第二个DDL就ok了,页面上写或者ItemDataBound内写事件挂接代码都可以。打开VS写测试却发现有点障碍哦,
在SelectedIndexChanged内要知道去绑定哪个行哪个列的DDL要费些周折
只有从DDL一级一级的向上找Parent最后找到DataGridItem,再利用其ItemIndex定位到行然后FindControl到要绑定的DDL,最终可以实现,好像比较累哦。
        随又想到DataGrid的ItemCommand事件,但发现WebControl内只有Button ImageButton LinkButtonCommandName属性和 CommandArgument属性,并可以将事件上浮(冒泡).DropDownList先天不足!真是郁闷~~~~~ 能不能自己改造呢?动手试试就知道了。

<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<!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" xml:lang="gb2312" lang="gb2312">
<head>
<title> ItemDataBoundGetColumnName </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="title" content="" />
<meta name="author" content="活靶子,Huobazi,www.AspxBoy.com" />
<meta name="subject" content="" />
<meta name="language" content="gb2312" />
<meta name="keywords" content="" />
<meta name="Copyright" content="www.AspxBoy.com" />
<meta name="robots" content="all" />

<script language="c#" runat="server">
void BindGrid()
{
        DataTable dt = new DataTable();
        DataRow dr;
        dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
        dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
        dt.Columns.Add(new DataColumn("DateTimeValue", typeof(DateTime)));
        dt.Columns.Add(new DataColumn("BoolValue", typeof(bool)));
        dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));
        for (int i = 0; i < 36; i++) {
            dr = dt.NewRow();
            dr[0] = i;
            dr[1] = "项 " + i.ToString();
            dr[2] = DateTime.Now;
            dr[3] = (i % 2 != 0) ? true : false;
            dr[4] = 1.23 * (i+1);
            dt.Rows.Add(dr);
        }
  dg.DataSource= dt;
  dg.DataBind();
}
void Page_Load(object o, EventArgs e)
{
     dg.PagerStyle.Mode = PagerMode.NumericPages;
     if(!IsPostBack)
     {
        BindGrid();
     }
}
 
void btnClick(object o , EventArgs e)
{
     Response.Write("页面回发,但是不执行ItemDataBound");
}
 
void PageChange(object o , DataGridPageChangedEventArgs e)
{
     dg.CurrentPageIndex = e.NewPageIndex;
     BindGrid();
}
void ItemDataBound(object o , DataGridItemEventArgs e)
{
     if(e.Item.ItemIndex > -1 )//必须
     {
          DataRowView drv = (DataRowView)e.Item.DataItem;
          for (int i=0; i<drv.Row.Table.Columns.Count ; i++)
          { 
            Response.Write(drv.Row.Table.Columns[i].ColumnName + "&nbsp;&nbsp;");
          }
     }
}
</script>

</head>
<body>
<form runat="server">
  <ASP:DataGrid id="dg" runat="server"      
   HeaderStyle-BackColor="#aaaadd"
   AutoGenerateColumns="true"
   AllowPaging="true"
   PageSize="6"
    OnItemDataBound="ItemDataBound"
    OnPageIndexChanged="PageChange"
  >
  </asp:DataGrid>
  </br>
   <asp:button id="btn" runat="server" onclick="btnClick" Text="我是按钮,按我一下"></asp:button>
在AutoGenerateColumns="false"使用绑定列或者模板列的时候只需要使用 

<font color="blut">YourDataGrid.Columns[编号].HeaderText</font> 去获取
  
</form>
</body>
</html>

http://www.aspxboy.com/Files/71/66/284.Aspx

 

24 Mar 2006

关于Data Access Blok (SqlHelper.cs)使用时出现

关于Data Access Blok (SqlHelper.cs)使用时出现"对象必须实现 IConvertible/Object must implement IConvertible."异常

在使用低版本 Data Access Blok  时,出现如下异常
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------

 

对象必须实现 IConvertible。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

 

异常详细信息: System.InvalidCastException: 对象必须实现 IConvertible。

 

源错误:

 
行 360:   
行 361:   //finally, execute the command.
行 362:   int retval = cmd.ExecuteNonQuery();
行 363:   
行 364:   // detach the SqlParameters from the command object, so they can be used again.

 

参考http://weblogs.asp.net/ssmith/archive/2003/08/19/24524.aspx#92222
做修改
the simple fix is to change line 93 to read:
commandParameters[i].Value = ((SqlParameter)parameterValues[i]).Value;

 

instead of:
commandParameters[i].Value = parameterValues[i];

 

正常工作。

24 Mar 2006

关于Data Access Blok (SqlHelper.cs)使用时出现

关于Data Access Blok (SqlHelper.cs)使用时出现"对象必须实现 IConvertible/Object must implement IConvertible."异常

在使用低版本 Data Access Blok  时,出现如下异常
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------

 

对象必须实现 IConvertible。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

 

异常详细信息: System.InvalidCastException: 对象必须实现 IConvertible。

 

源错误:

 
行 360:   
行 361:   //finally, execute the command.
行 362:   int retval = cmd.ExecuteNonQuery();
行 363:   
行 364:   // detach the SqlParameters from the command object, so they can be used again.

 

参考http://weblogs.asp.net/ssmith/archive/2003/08/19/24524.aspx#92222
做修改
the simple fix is to change line 93 to read:
commandParameters[i].Value = ((SqlParameter)parameterValues[i]).Value;

 

instead of:
commandParameters[i].Value = parameterValues[i];

 

正常工作。

05 Jan 2006

SourceCodeViewer 0.1 and Ms treeview 's problem
SourceCodeViewer 0.1

一直想给自己网站放一个源码浏览器,发现Scott Watermasysk做的Cojax很酷,但却找不到同类的asp.net的开源项目,就决定自己做一个,顺便学习ajax .基本做出了个雏形,语法高亮也只能支持到 C#,Jscript,htm.
树用的是MS treeview ,但郁闷的事情也来了,MS treeview在firefox下render出的html竟然和ie下一点都不相同,而且是采用postback方式展开节点,我给tree上加的onclick不起作用,导致目前这个东东在firefox下不能用,继续研究中....

An open source web based Source Code Viewer system application
written in ASP.NET / C#.NET / Javascript with ajax for the Windows OS and .Net FrameWork platform.

Homepage : http://www.github.com/scv/
Online demo : http://www.github.com/code/
Online screenshots : http://sourceforge.net/project/screenshots.php?group_id=155912
On Sourceforge : http://sourceforge.net/projects/scv
Download the latest version 0.1 including the source code :
http://sourceforge.net/project/s ... p;release_id=382944

Screenshots: