标题:急! JavaScript 问题
取消只看楼主
bimary
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-3-4
 问题点数:0 回复次数:0 
急! JavaScript 问题
我要实现按用户ID 用户姓名(假设英文) 用户生日排序,下面这些代码不知如何修改,后台代码往哪插,谢谢指点

Javascript代码如下:
<script language="javascript">
function Getsort(obj)
{
document.all.sortfield.value=obj;
if (document.all.sortstring.value == 'ASC')
{
document.all.sortstring.value = 'DESC';
}
else if (document.all.sortstring.value == 'DESC')
{
document.all.sortstring.value = 'ASC';
}
__doPostBack('LinkButton1','');
}
</script>
HTML中:
<INPUT type="hidden" id="sortfield" runat="server">
<INPUT type="hidden" id="sortstring" runat="server" value="ASC">
<td ondblclick="Getsort('Text');"><b>双击此处可排序</b></td>
后台代码如下:
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
CreaterDataSource("Text ASC");
}
}

private void CreaterDataSource(string sort)
{
OleDbConnection dbCon = new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("Test.mdb"));
dbCon.Open();
OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Table", dbCon);
DataTable dt = new DataTable();
adapter.Fill(dt);
DataView dv = dt.DefaultView;
dv.Sort = sort;
Repeater1.DataSource=dv;
Repeater1.DataBind();
}

private void LinkButton1_Click(object sender, System.EventArgs e)
{
string sortString = Request.Form["sortstring"].ToString();
string sortfield = Request.Form["sortfield"].ToString();
string fullsortstring = sortfield+" "+sortString;
if (fullsortstring != ""&& fullsortstring!=null)
{
CreaterDataSource(fullsortstring);
}
}
搜索更多相关主题的帖子: JavaScript 
2006-03-05 13:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-48506-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.784897 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved