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.
Unfortunately, activation email could not send to your email. Please try again.

Grid post backs

Thread ID:

Created:

Updated:

Platform:

Replies:

50691 Oct 17,2006 08:04 AM Oct 19,2006 07:07 PM ASP.NET Web Forms (Classic) 7
loading
Tags: GridGroupingControl
Michael Digman
Asked On October 17, 2006 08:04 AM

I am using the ASP.NET GridGroupingControl (version 4.301.0.32) and constructing a System.Data.DataTable programatically and assigning this as the DataSource. I have managed to setup the grid columns for filtering and sorting, but when I select an option in the filter drop down or click on a column, the page seems to post back to the server and then I get a System.Web.HttpUnhandledException thrown. Is their something I need to do? Looking at the example everything seems to occur automatically.

Can someone help please.

Cheers,

Michael

Administrator [Syncfusion]
Replied On October 17, 2006 08:56 AM

Hi Michael,

As mentioned in our Users Guide, Essential Grid expects the data source to include a primary key column. Make sure to include a PrimaryKeyColumn to the TableDescriptor before calling DataBind(), as shown below.

Here is an example of how the WebPage's Init would typically look in an Application using the GridControl.


[C#]

private void Page_Init(object sender, System.EventArgs e)

{
//Add a primary key to the PrimaryKeyColumns collection

GridTableDescriptor mainTD = this.GridGroupingControl.TableDescriptor;

// CustomerID could be a field name in the datasource

mainTD.PrimaryKeyColumns.Add("CustomerID");

//Call DataBind

this.GridGroupingControl.DataBind();

}

Let us know if this helps.

Thanks,
A.Sivakumar

Michael Digman
Replied On October 17, 2006 12:11 PM

Thanks for the reply. I am setting the primary key and binding the control to the data.

The only difference being that I have set the primary key to a column that is hidden. Could this be the issue.

I have managed to extract the exception if it helps (see attachment).

Cheers,

Michael

exception8.zip

Administrator [Syncfusion]
Replied On October 17, 2006 01:13 PM

Hi Michael,

I assume you are binding the grid in Page's Load event, whereas our grid requires to be binded in Page's Init event. Could you please make sure this is taken care in your sample?

We apologize for any inconvenience caused.

Thanks,
A.Sivakumar

Michael Digman
Replied On October 18, 2006 11:29 AM

Thanks, I've managed to get past the exceptions by making sure the data is bound to the control in the pages Init event.

Do I have to rebind the data to the control everytime I post back to the server? This seems like a big overhead as the data source I'm using is not directly tide to a database and won't change that often.

Another question I have revolves around the use of client side javascript. How do I call a javascript function when a row is selected on the grid?

Cheers,

Michael

Administrator [Syncfusion]
Replied On October 18, 2006 03:58 PM

Hi Michael,

Yes, you have to rebind the control every time, this is because we avoid caching of data at client side , but because of a lot of requests, we already started implementing DataCaching and so you will not do this once this feature, gets implemented. This feature is almost completed and will be available by the end of this month.

When a row is selected on the client side 'Onselectedrowchanged' client side event will be triggered. You can use the following code to do this

var gridObj = __EssentialGridCollection.Get("GridGroupingControl1");
// the grids id

gridObj.onselectedrowchanged =OnSelectedRowChanged;

function OnSelectedRowChanged(gridobj,tr)
{
//tr will give you the selected row element.
var SelRowId=tr.id;

}

Let us know if you need more info.

Thanks,
A.Sivakumar

Michael Digman
Replied On October 19, 2006 08:35 AM

When the OnSelectedRowChanged() function is called is there a simple way of working out if it is a select or a deselect?

Cheers,

Michael

Administrator [Syncfusion]
Replied On October 19, 2006 07:07 PM

Hi Michael,

We tried for a while on this, but couldn't see some easy way to do this. However, we will check more about this and will let you know later.

Thankyou for using syncfusion products.

Thanks,
A.Sivakumar

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;