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.
}
}