asp.net中怎么根据标题列排序?
我根据asp.net2.0高级编程(特别版)做,上面写的也不是很多,运行后并没有实现效果,不知道为什么了?1.我设置了AllowSorting="True"2.//标题列...
我根据asp.net2.0高级编程(特别版)做,上面写的也不是很多,运行后并没有实现效果,不知道为什么了?
1.
我设置了AllowSorting="True"
2.
//标题列进行【排序】
protected void gvCar_Sorting(object sender, GridViewSortEventArgs e)
{
string oldCar = gvCar.SortExpression;
string newCar = e.SortExpression;
if (oldCar.IndexOf(newCar)<0)
{
if (oldCar.Length > 0)
e.SortExpression = newCar + "," + oldCar;
else
e.SortExpression = newCar;
}
else
{
e.SortExpression = oldCar;
}
}
我直接在Sorting这个事件中写了,不知道问题出在哪呢?希望高人指教!
它的源代码:
<script runat="server">
protected void gvCar_Sorting(object sender, GridViewSortEventArgs e)
{
string oldCar = gvCar.SortExpression;
string newCar = e.SortExpression;
if (oldCar.IndexOf(newCar)<0)
{
if (oldCar.Length > 0)
e.SortExpression = newCar + "," + oldCar;
else
e.SortExpression = newCar;
}
else
{
e.SortExpression = oldCar;
}
}
</script>
我用的是vs2008开发 展开
1.
我设置了AllowSorting="True"
2.
//标题列进行【排序】
protected void gvCar_Sorting(object sender, GridViewSortEventArgs e)
{
string oldCar = gvCar.SortExpression;
string newCar = e.SortExpression;
if (oldCar.IndexOf(newCar)<0)
{
if (oldCar.Length > 0)
e.SortExpression = newCar + "," + oldCar;
else
e.SortExpression = newCar;
}
else
{
e.SortExpression = oldCar;
}
}
我直接在Sorting这个事件中写了,不知道问题出在哪呢?希望高人指教!
它的源代码:
<script runat="server">
protected void gvCar_Sorting(object sender, GridViewSortEventArgs e)
{
string oldCar = gvCar.SortExpression;
string newCar = e.SortExpression;
if (oldCar.IndexOf(newCar)<0)
{
if (oldCar.Length > 0)
e.SortExpression = newCar + "," + oldCar;
else
e.SortExpression = newCar;
}
else
{
e.SortExpression = oldCar;
}
}
</script>
我用的是vs2008开发 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询