We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Next Page

I am using the following code to set some data in text boxes and lables when a new row is selected:

protected void grdLocations_SelectedRecordsChanged(object sender, SelectedRecordsChangedEventArgs e)
{
Locations locs = new Locations();
// Cancel the previous record edit mode

if (this.grdLocations.Table.CurrentRecord == null)
return;


// Get the currently selected record in the master grid

int locID = (int)this.grdLocations.Table.CurrentRecord.GetValue("LocationID");
lblLocationID.Text = locID.ToString();
int order = (int)this.grdLocations.Table.CurrentRecord.GetValue("DisplayOrder");
txtDisplayOrder.Text = order.ToString();
lblDisplayOrder.Text = order.ToString();

When I select the Next Page button this event fires, but the CurrentRecord data is the old row not the new row on the Next Page.

11 Replies

SI Sivakumar Syncfusion Team August 22, 2006 08:53 AM UTC

Hi Greg,

We are able to see this issue and are looking for some possible solutions to overcome this issue.

We will get back to you as early as possible.

Sorry for the inconvenience caused.

Thanks,
A.Sivakumar



SB Suresh Babu Syncfusion Team August 25, 2006 03:19 AM UTC

Hi Greg,

We are started to create sample to overcome this issue.

We will get back to you tomorrow.

Sorry for the inconvenience caused.

Thanks,
D.Suresh Babu


SI Sivakumar Syncfusion Team August 29, 2006 11:44 PM UTC

Hi Greg,

My sincere apology for the delay in responding to you. We previoulsy consider this something similar to the issue
you were facing because of preventing the selection of first record row when the page loads. and when we reviewed the code
again we figured the following code will solve this issue.

Here instead of getting the current record we get the currentElement and then the current record from this element.

Here is the modified code which can be used to solve the issue.

[C#]
protected void grdLocations_SelectedRecordsChanged(object sender, SelectedRecordsChangedEventArgs e)
{

// Get the currently selected Element in the master grid
Element el = e.Table.CurrentElement;
//Getting the record from the current element.
Record rd = el.GetRecord();
//Checking for the existance of records
if (rd == null)
return;

int locID = (int)rd.GetValue("LocationID");
lblLocationID.Text = locID.ToString();
int order = (int)rd.GetValue("DisplayOrder");
txtDisplayOrder.Text = order.ToString();
lblDisplayOrder.Text = order.ToString();

}

Again I apologize for the inconvenience caused, also we will update a sample illustrating this before tomorrow noon.

Please let me know if you have any queries.

Best Regards,
A.Sivakumar


GM Greg Mills August 30, 2006 10:49 PM UTC

Yuor solution gets the same result. The current element when selecting the next page button is the first record in the table not the next record on the new page.


SI Sivakumar Syncfusion Team August 30, 2006 11:26 PM UTC

Hi Greg,

I saw that my code works fine in postback mode and I could see the issue you mentioned only in callback mode. I will check this and will update you as soon as possible.

Thanks,
A.Sivakumar


SI Sivakumar Syncfusion Team September 1, 2006 02:49 PM UTC

Hi Greg,

Kindly accept my apology for the delay in getting back to you. We are working on this with very high priority and will surely update at the earliest.

sorry for the inconvenience caused and thanks for your patience.

Regards,
A.Sivakumar


SI Sivakumar Syncfusion Team September 1, 2006 06:49 PM UTC

Hi Greg,

For updating the selected records value in a label during callback, when clicking on a ''Nextpage''/''PreviousPage'' button we should follow the below steps.

a) Grid Grouping Control''s before Callback event:
---------------------------------------------


The GridGrouping Control''s before callback script event should be used to trigger the multiplexer''s callback event instead of gri''s callback. i.e In the grid''s before callback
what we does is we will cancel''s the Grid''s callback, and instead invoke the multiplexer''s doCallback method.

Here in this ''Client side'' event we will check the argument at client side which triggers the callback.
then based on our requirements we will have to decide on triggering the Callback multiplexer, also we will mention the control
that has to be refreshed in the grid''s event. please look in to the attached sample for more information

[Sample code]

Here is a sample code on how the script of before callback script will look like for a next page button click.

//We check the argument here, like if the argument contains the string ''NEXTPAGE'' , which is used to figure out that callback is triggered by clicking on a next page button, we also ensure
/this by checking the button''s index (''5 '') here then we cancel the grid''s callback (this.continueCallback = false;) .
//We trigger callback multiplexer''s callback and also the grid by specifying grid as the argumentfor multiplexer.

this.InboxGrid.BeforeCallbackScript = "if( arg.indexOf(''NEXTPAGE:BB:'')!=-1 && (arg.indexOf(''5'') != -1)){this.continueCallback = false;__sfCallbackMultiplexer1.doCallback(''InboxGrid'', arg);}";

//similarly you have to check in the client side for each action.


b)Using Multiplexer:
------------------

Once the above is done the callback will trigger the corresponding event and you can refresh your label which is inside a callbackpanel by refreshing the
callback panel.

[sample code]

this.CallbackMultiplexer1.ControlsToRefresh.Add(this.CallbackPanel1);



We faced some issues here and this made some delay. because in our situation we were in need of defining the
callbackMultiplexer''s refresh in both ''SelectedRecordsChanged'' event and ''ButtonBarClickEvent'' for previous and
next buttons.

To overcome this scenario we decided to keep each CallbackMuliplexer for each events and to refresh the callback panel seperately inside
the buttonbar click event. Eg (We will have ''3'' CallbackMultiplexer when we are in need of selection changed, next button and previous button
to be handled) . In the sample I have also illustrated for move last and move fist record.

Click the below link to download the sample.

Sample for updating the selection and paging in callback



Regards,
A.Sivakumar


SI Sivakumar Syncfusion Team September 1, 2006 07:20 PM UTC

Hi Greg,

I just noticed some unexpected behavior in the sample when using the previous page button. we will look in to it and will update you
soon.

Please, let me know if you have any queries.

Thanks,
A.Sivakumar


SI Sivakumar Syncfusion Team September 6, 2006 12:05 AM UTC

Hi Greg,

The issue I mentioned in my sample posted prevously is confirmed to be a issue which can be overcomed by
using the ''EnsureSelection'' property we have been discussing in
this forum


Sorry for the inconvenience caused and thanks for your patience

Thanks,
A.Sivakumar


GM Greg Mills September 20, 2006 07:43 PM UTC

Where is the EnsureSelction Property located. I don''t see it.

>Hi Greg,

The issue I mentioned in my sample posted prevously is confirmed to be a issue which can be overcomed by
using the ''EnsureSelection'' property we have been discussing in
this forum


Sorry for the inconvenience caused and thanks for your patience

Thanks,
A.Sivakumar


GM Greg Mills September 20, 2006 08:34 PM UTC

This is working now.

>Where is the EnsureSelction Property located. I don''t see it.

>Hi Greg,

The issue I mentioned in my sample posted prevously is confirmed to be a issue which can be overcomed by
using the ''EnsureSelection'' property we have been discussing in
this forum


Sorry for the inconvenience caused and thanks for your patience

Thanks,
A.Sivakumar

Loader.
Live Chat Icon For mobile
Up arrow icon