小山
付出最大努力,追求最高成就,享受最佳生活,收获无悔人生
博客园
首页
新随笔
联系
订阅
管理
193 Posts :: 0 Stories :: 1156 Comments :: 70 Trackbacks
公告
以每年的11月17日为界,来看看这一年中我的事业是否有发展、看看我的生活是否快乐、看看我的梦想是否已实现,也时时提醒自己离目标还很远
与我联系
发短消息
搜索
常用链接
我的随笔
我的空间
我的短信
我的评论
更多链接
我的参与
我的新闻
最新评论
我的标签
留言簿
(189)
给我留言
查看留言
我参与的团队
Ajax&Atlas技术团队(0/1149)
成都.NET俱乐部(0/1023)
随笔分类
(206)
ADO.NET(1)
Ajax&Altas(8)
API(2)
ASP.NET(14)
ASP.NET2.0(3)
Blog(1)
C#(9)
DataGrid(19)
DropDownList(9)
English Study(1)
HTC(1)
Html/css(2)
Infragistics(1)
JavaScript(14)
Menu(2)
Oracle(1)
SEO|搜索引擎优化 (3)
Sql Server(7)
TreeView(2)
UML(12)
VS.NET(3)
VSS(2)
Web Services(3)
Winform
XmlHttp(4)
案例分析(1)
创业(3)
第三方控件(3)
非技术区(1)
经典算法(3)
精彩网址(13)
汽车保险(2)
软件工程(2)
设计与模式(23)
水晶报表
网站推广(3)
我的生活(2)
系统分析/设计(3)
项目管理(15)
休闲娱乐
学习资料(7)
正则表达式(1)
随笔档案
(194)
2008年8月 (1)
2008年7月 (3)
2008年5月 (1)
2007年11月 (2)
2007年10月 (1)
2007年8月 (1)
2007年3月 (1)
2006年9月 (2)
2006年8月 (1)
2006年7月 (2)
2006年6月 (1)
2006年5月 (5)
2006年4月 (4)
2006年3月 (5)
2006年2月 (3)
2006年1月 (10)
2005年12月 (23)
2005年11月 (29)
2005年10月 (99)
友情链接
满分教育网
女人宝贝
世界之窗
手表折扣网
手机折扣网
折扣购物网
折扣网
最新随笔
1. 网站掉进沙盒,折扣网给你分析前后原因
2. PMP考试通过了^_^
3. 以每年的11月17日为界
4. 如何开始创业(转)
5. 如何组织高效的项目会议
6. 项目管理的20条锦囊妙计
7. Alexa世界排名原理,为网站赢得好排名
8. SEO|搜索引擎优化(如何让你的网站排名靠前)
9. Ajax实现无刷新三联动下拉框
积分与排名
积分 - 486397
排名 - 37
最新评论
1. re: 阴历阳历转换
请问1986年阴历1月27日是阳历的哪一天?
--王现玲
2. re: 通过HtmlInputFile控件上传文件的类
good !!
--123yyyyyyyyyyyyyyyyy
3. re: ASP.NET2.0 TreeView
很好 很感谢
--Michael Xu
4. re: Web的桌面提醒(Popup,类似msn,outlook等的信息提示)
我想用Ajax的Timerk控件定时刷新数据库,然后弹出那个信息窗口
但是在页面上窗口弹不出来,不知道为什么,请小山老师帮忙,谢谢
--专研.NET
5. re: ASP.NET2.0 TreeView
public partial class Page_Wonderful_TreeView_System.Web.UI.Page这句中的System.Web提示"类结构或接口成员声明中的标记&...
--aito8
6. re: SEO|搜索引擎优化(如何让你的网站排名靠前)
呵呵,学习啦。
--大李
7. re: 导出导入Excel(DataSet,DataGrid)
@
利用ODBC读取EXCEL数据到DS中就OK了。不过会发生数据转换上的问题。需要精确控制数据那么需要用COM来读取EXCEL文件了
--执迷不悟
8. re: SQL SERVER 与ACCESS、EXCEL的数据转换
excel导入sql的时候数据转换会出问题!比如编号001导进去就变成1;而100这样的整数进去会变成100.00。
--执迷不悟
9. re: PMP考试通过了^_^
恭喜!博主能不能谈谈前前后后考试的经过呢?
--村蝈蝈
阅读排行榜
1. Ajax实现无刷新三联动下拉框(46510)
2. 功能齐全的DataGrid(24539)
3. XmlHttp实现无刷新三联动下拉框(16124)
4. 下载网址集锦(13520)
5. 多级下拉菜单(动态)(11762)
6. Ajax使用初步(10769)
7. 通用分页控件(DataGrid,DataList,Repeater都可以用它来分页)(10072)
8. 阴历阳历转换(9770)
9. Ajax.NET的几个示例代码(9358)
10. 下拉日期控件(7810)
评论排行榜
1. Ajax实现无刷新三联动下拉框(195)
2. 功能齐全的DataGrid(70)
3. XmlHttp实现无刷新三联动下拉框(61)
4. 多级下拉菜单(动态)(44)
5. DataHelper(38)
6. Ajax使用初步(34)
7. ASP.NET2.0 TreeView(33)
8. Alexa世界排名原理,为网站赢得好排名(31)
9. 下拉日期控件(30)
10. Ajax.NET的几个示例代码(30)
功能齐全的DataGrid
//
目前功能:编辑、排序、单选项、复选项、合并单元格、产生序列号、联动下拉框、删除、超连接、鼠标移动改变颜色、奇偶项颜色区分、排序、分页
1.html代码
<
HTML
>
<
HEAD
>
<
title
>
DatagridTest
</
title
>
<
meta
content
="Microsoft Visual Studio .NET 7.1"
name
="GENERATOR"
>
<
meta
content
="C#"
name
="CODE_LANGUAGE"
>
<
meta
content
="JavaScript"
name
="vs_defaultClientScript"
>
<
meta
content
="http://schemas.microsoft.com/intellisense/ie5"
name
="vs_targetSchema"
>
<
script
language
="javascript"
>
function
fun_option(obj)
{
document.Form1.hiduserid.value
=
obj.value;
}
function
chkAll_true()
{
var
chkall
=
document.all[
"
chkAll
"
];
var
chkother
=
document.getElementsByTagName(
"
input
"
);
for
(
var
i
=
0
;i
<
chkother.length;i
++
)
{
if
( chkother[i].type
==
'checkbox')
{
if
(chkother[i].id.indexOf('chkExport')
>-
1
)
{
if
(chkall.checked
==
true
)
{
chkother[i].checked
=
true
;
}
else
{
chkother[i].checked
=
false
;
}
}
}
}
}
function
Delete()
{
var
al
=
new
Array();
var
chkother
=
document.getElementsByTagName(
"
input
"
);
for
(
var
i
=
0
,j
=
0
;i
<
chkother.length;i
++
)
{
if
( chkother[i].type
==
'checkbox')
{
if
(chkother[i].id.indexOf('chkExport')
>-
1
)
{
if
(chkother[i].checked
==
true
)
{
al[j]
=
chkother[i].value;
j
++
;
}
}
}
}
if
(al
==
""
)
{
alert('You need to select a row
in
the list before selecting Delete.\r\nPlease select a row and
try
again.');
}
else
if
(window.confirm(
"
Are you sure to delete all these?
"
))
{
var
deleteID
=
'
<%=
btndelete.ClientID
%>
';
window.document.all(deleteID).click();
}
else { return false; }
}
</
script
>
</
HEAD
>
<
body
>
<
form
id
="Form1"
method
="post"
runat
="server"
>
<
TABLE
id
="Table1"
height
="100%"
cellSpacing
="1"
cellPadding
="1"
width
="100%"
border
="1"
>
<
tr
>
<
td
><
asp:dropdownlist
id
="DropDownList1"
runat
="server"
AutoPostBack
="True"
></
asp:dropdownlist
><
asp:dropdownlist
id
="DropDownList2"
runat
="server"
AutoPostBack
="True"
></
asp:dropdownlist
><
asp:dropdownlist
id
="DropDownList3"
runat
="server"
></
asp:dropdownlist
><
asp:textbox
id
="TextBox1"
runat
="server"
></
asp:textbox
><
asp:checkbox
id
="CheckBox1"
runat
="server"
Text
="可见否"
></
asp:checkbox
><
asp:button
id
="Button1"
runat
="server"
Text
="保存"
></
asp:button
><
asp:button
id
="Button2"
runat
="server"
Text
="导出Excel"
></
asp:button
></
td
>
</
tr
>
<
tr
height
="30"
>
<
td
><
INPUT
id
="chkAll"
onclick
="chkAll_true()"
type
="checkbox"
>
全选/取消
<
asp:button
id
="btndelete"
runat
="server"
Text
="删除"
></
asp:button
></
td
>
</
tr
>
<
TR
vAlign
="top"
>
<
TD
width
="100%"
colSpan
="5"
><
asp:datagrid
id
="DataGrid1"
runat
="server"
OnDeleteCommand
="Delete"
ForeColor
="Black"
GridLines
="None"
CellPadding
="2"
BackColor
="LightGoldenrodYellow"
BorderWidth
="1px"
BorderColor
="Tan"
AllowSorting
="True"
AutoGenerateColumns
="False"
DataKeyField
="UserID"
OnUpdateCommand
="Update"
OnCancelCommand
="Cancel"
OnEditCommand
="Edit"
PageSize
="5"
AllowPaging
="True"
>
<
FooterStyle
BackColor
="Tan"
></
FooterStyle
>
<
SelectedItemStyle
ForeColor
="GhostWhite"
BackColor
="DarkSlateBlue"
></
SelectedItemStyle
>
<
AlternatingItemStyle
BackColor
="PaleGoldenrod"
></
AlternatingItemStyle
>
<
HeaderStyle
Font-Bold
="True"
BackColor
="Tan"
></
HeaderStyle
>
<
Columns
>
<
asp:TemplateColumn
HeaderText
="序号"
>
<
HeaderStyle
Width
="10px"
></
HeaderStyle
>
<
ItemTemplate
>
<
INPUT
id
=radio
onclick
=fun_option(this)
type
=radio
value
='<%#
DataBinder.Eval(Container.DataItem,"UserID") %
>
' name=radio>
</
ItemTemplate
>
<
FooterTemplate
>
</
FooterTemplate
>
</
asp:TemplateColumn
>
<
asp:TemplateColumn
HeaderText
="序号"
>
<
HeaderStyle
Width
="10px"
></
HeaderStyle
>
<
FooterTemplate
>
</
FooterTemplate
>
</
asp:TemplateColumn
>
<
asp:TemplateColumn
>
<
HeaderStyle
Width
="10px"
></
HeaderStyle
>
<
ItemTemplate
>
<
asp:CheckBox
id
="chkExport"
Runat
="server"
></
asp:CheckBox
>
</
ItemTemplate
>
</
asp:TemplateColumn
>
<
asp:BoundColumn
DataField
="UserID"
SortExpression
="UserID"
ReadOnly
="True"
HeaderText
="UserID"
>
<
HeaderStyle
Width
="70px"
></
HeaderStyle
>
</
asp:BoundColumn
>
<
asp:TemplateColumn
SortExpression
="UserName"
HeaderText
="姓名"
>
<
HeaderStyle
Width
="70px"
></
HeaderStyle
>
<
ItemTemplate
>
<
a
href
='form1.aspx?id=<%#
DataBinder.Eval(Container.DataItem,"UserID") %
>
&name
=
<%
# DataBinder.Eval(Container.DataItem,
"
UserName
"
)
%>
' target="_blank">
<%
# DataBinder.Eval(Container.DataItem,
"
UserName
"
)
%>
</
a
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
id
=UserName
Text
='<%#
DataBinder.Eval(Container.DataItem,"UserName") %
>
' Width="100%" Runat="server">
</
asp:TextBox
>
</
EditItemTemplate
>
</
asp:TemplateColumn
>
<
asp:TemplateColumn
SortExpression
="province"
HeaderText
="省市"
>
<
HeaderStyle
Width
="70px"
></
HeaderStyle
>
<
ItemTemplate
>
<%
# DataBinder.Eval(Container.DataItem,
"
province
"
)
%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:DropDownList
id
="province"
Width
="100%"
Runat
="server"
AutoPostBack
="True"
OnSelectedIndexChanged
="ddlprovince_SelectedIndexChanged"
></
asp:DropDownList
>
</
EditItemTemplate
>
</
asp:TemplateColumn
>
<
asp:TemplateColumn
SortExpression
="city"
HeaderText
="县市"
>
<
HeaderStyle
Width
="70px"
></
HeaderStyle
>
<
ItemTemplate
>
<%
# DataBinder.Eval(Container.DataItem,
"
city
"
)
%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:DropDownList
id
="city"
Runat
="server"
Width
="100%"
AutoPostBack
="True"
OnSelectedIndexChanged
="ddlcity_SelectedIndexChanged"
></
asp:DropDownList
>
</
EditItemTemplate
>
</
asp:TemplateColumn
>
<
asp:TemplateColumn
SortExpression
="area"
HeaderText
="乡镇"
>
&nbs