在页面级别重新排序gridview行 [英] reordering of gridview rows at the page level

查看:97
本文介绍了在页面级别重新排序gridview行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我需要从数据库表中实现gridview。然后它应该有助于重新排序gridview的行,然后点击一个保存按钮,记录将保存在另一个具有所选顺序的类似表中。 Gridview几乎不会有10行。



例如



格式可以是



t1 descr1 upbtn downbtn

t2 descr2 upbtn downbtn

t3 descr3 upbtn downbtn











我的问题是如何重新排序gridview的行在保存之前的页面级别。我正在考虑创建一个viewstate变量,在该变量中存储绑定到gridview的数据集,并为列中的每一行设置向上和向下按钮。当用户单击其中一个按钮时,将更新viewstate变量并将gridview i绑定到该viewstate变量以描述当前顺序。保存使用viewstate数据集。



你们有另外一个建议吗?你认为在每一行中都有上下按钮是有意义的,或者应该有一个用户输入整数的文本框,但是用户可能会错误地重复数字等。



谢谢,



Vijay

Hi,

I need to implement a gridview from a database table. Then it should facilitate to reorder the rows of the gridview and then hit a save button and the records gets saved in another similar table with the chosen order. Gridview can have hardly 10 rows.

e.g.

format can be

t1 descr1 upbtn downbtn
t2 descr2 upbtn downbtn
t3 descr3 upbtn downbtn
.
.
.


My question is how should I reorder the rows of the gridview at the page level before saving. I was thinking of creating a viewstate variable in which to store the dataset which is bound to the gridview and have up and down button for each row in a column. As user clicks one of these button the viewstate variable is updated and bind the gridview i to that viewstate variable to depict the current order. For saving use viewstate dataset.

Do you guys have another suggestion? Do you think having up and down button in each row make sense or there should be a textbox where user enters an integer but then user can make mistake of having duplicate numbers etc.

Thanks,

Vijay

推荐答案

我不会使用gridview,我会写我的自己控制以更好地控制数据和渲染。我然后使用箭头并使用javascript交换客户端,可能使用隐藏变量来存储一个列表,告诉我回发时的新订单。
I would not use a gridview, I'd write my own control to have more control over the data and the rendering. I'd then use arrows and use javascript to swap on the client end, probably using a hidden variable to store a list that told me the new order on postback.


U总是可以排序数据表取决于列名..

对它进行排序并保存回来! :)



您还可以根据列名对网格视图进行排序...
U can always sort a datatable depending on a column name ..
Sort it and save it back ! :)

U can also sort a gridview based on a column name...


对不起,迟到的回复..

u可以通过创建数据视图对数据表进行排序 -



Exp;



DataView dataView = new DataView(dTable);



dataView.Sort =AutoID DESC,Name DESC;
Sorry for late reply ..
u can sort the datatabe by creating a dataview out of it -

Exp;

DataView dataView = new DataView(dTable);

dataView.Sort = " AutoID DESC, Name DESC";


这篇关于在页面级别重新排序gridview行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆