问题描述
我使用的是具有分页功能的GridView控件。我的网格有一个命令列和 ShowSelectCheckbox
设置为true。我绑定数据表
到的Page_Load
事件与条件电网[如果(!IsCallback)
。
所以,当我改变页面的索引数据丢失。之后,我写了绑定code到网格的 PageIndexChanged
事件。现在,它像魅力。
但 GetSelectedFieldValues
仅在第一页时,工作的SelectionChanged
事件发生。
在例如,当我选择在第一页排它得到我想要的字段值。但是,当我改变的PageIndex GetSelectedField
不能得到字段值。它提醒空的文本。
如果我选择在第二页索引一排它工作在该页面也一样,但是当我改变页面索引它再次被打破。
BTW,当我在绑定 pageLoad的
事件电网作品,未经!IsCallback
的条件,但我不能绑定因为其他控制它在的Page_Load
事件必须更改查询等数据。
下面去哪些警报选定值我的JavaScript函数
< ClientSideEvents的SelectionChanged =功能(S,E){
grid.GetSelectedFieldValues('SDNO; SANTRAL,警告);
}/>
和页面索引更改事件
保护无效myGrid_PageIndexChanged(对象发件人,EventArgs的发送)
{
myGridDataSource = dtable; // dtable是静态的,我也用BindThat功能也在这里。但是,没有出路。
myGridDataBind();
}保护无效的Page_Load(对象发件人,EventArgs的发送)
{
如果(!IsCallback)
{
BindThat(); //从数据库提取数据,创建dtable并将其绑定到网格。
}
}
ASPxClientGridView.GetSelectedFieldValues方法来发送回调来获得指定的数据。所以,如果你没有这个回调在服务器端绑定ASPxGridView。(你居然不 - 因为条件[!如果(IsCallback)])的电网不能返回数据
顺便说一句,这个工作确认当期的页面上,因为ASPxGridView是缓存当前页面的数据(见EnableRowsCache财产定义)。
I'm using a gridview with paging. My grid has a command column and ShowSelectCheckbox
is set to true. I bind DataTable
to grid at Page_Load
event with the condition [ if (!IsCallback)
].
So when i change page index data is lost. After that i wrote bind code to grid's PageIndexChanged
event. Now it works like charm.
But GetSelectedFieldValues
works only at first page when SelectionChanged
event occurs.
In example when i select a row at first page it gets the field values that i want. But when i change pageindex GetSelectedField
cannot get the field values. It alerts empty text.
If i select a row at second page index it works at that page too, but when i change page index it's broken again.
BTW it works when i bind the grid at PageLoad
event without !IsCallback
condition but i can't bind it at Page_Load
event because of other controls must have to change the query and so data.
Here goes my javascript function which alerts selected values
<ClientSideEvents SelectionChanged="function(s, e) {
grid.GetSelectedFieldValues('SDNO;SANTRAL',alert);
}" />
And page index changed event
protected void myGrid_PageIndexChanged(object sender, EventArgs e)
{
myGridDataSource = dtable; //dtable is static, i also used BindThat function here too. But no way out.
myGridDataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsCallback)
{
BindThat(); // Fetch data from db, create dtable and bind it to grid.
}
}
ASPxClientGridView.GetSelectedFieldValues method send a callback to get the specified data. So, if you don't bind the ASPxGridView at the server side on this callback (and you actually don't - because of condition [ if (!IsCallback) ]) grid cannot return the data.
BTW, this works on the currect page because ASPxGridView is caching the data for the current page (see EnableRowsCache property definition).
这篇关于Devex preSS ASPxGridView GetSelectedFieldValues无法获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!