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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Edit all rows of dynamic grid

Thread ID:

Created:

Updated:

Platform:

Replies:

34268 Sep 7,2005 08:51 AM UTC Sep 14,2005 02:23 PM UTC ASP.NET Web Forms (Classic) 11
loading
Tags: GridGroupingControl
Administrator [Syncfusion]
Asked On September 7, 2005 08:51 AM UTC

Hi I have generated the grid dynamically, where all the data, including column headers, is pulled from datasets. After which, i would like to edit all the rows at the same time from this dynamically created grid. May i know if this is being supported? Any assistance much appreciated. I am using C# on ASP.NET 2.0).

Administrator [Syncfusion]
Replied On September 7, 2005 11:13 AM UTC

Hi This can be accomplished using templates and is demonstrated in the EditAllRows sample. Essential Studio 3.3 ships with Whidbey (beta 2) samples for Essential Grid for ASP.NET. Take a look at the sample located in the \Syncfusion\Essential Studio\3.3.0.0\Web\Grid.Grouping.Web\Samples\2.0\Editing\EditAllRows folder or via the Sample Browser by choosing Visual Studio 2.0. You can download Essential Studio 3.3 from : www.syncfusion.com/latestversion.aspx Regards Arun

Administrator [Syncfusion]
Replied On September 8, 2005 01:18 AM UTC

Hi, Thanks for your prompt reply. However what i wish to do is different from the sample in a way such that the columns which i pull from the dataset varies all the time. Is it still possible to use templates? >Hi > >This can be accomplished using templates and is demonstrated in the EditAllRows sample. Essential Studio 3.3 ships with Whidbey (beta 2) samples for Essential Grid for ASP.NET. Take a look at the sample located in the \Syncfusion\Essential Studio\3.3.0.0\Web\Grid.Grouping.Web\Samples\2.0\Editing\EditAllRows folder or via the Sample Browser by choosing Visual Studio 2.0. > >You can download Essential Studio 3.3 from : >here > >Regards >Arun >

Administrator [Syncfusion]
Replied On September 8, 2005 02:29 AM UTC

Correct me if i''m wrong. To be able to edit all the rows using templates, i will have to define the the columns header in the code first nad it is not possible to do so if the columns header keep changing and when the number of columns varies.

Administrator [Syncfusion]
Replied On September 8, 2005 03:11 PM UTC

Yes, you are correct, the templates can only be defined in the designer. A good and easy workaround for this is to use a dummy grid in the form with a dummy column descriptor initialized with the template you will be using in the grid whose columns will be dynamically generated. You can then reuse that template from the dummy grid in the dynamically initialized grid. A simple retrieval and assignment like this will do: ITemplate desiredTemplate = this.dummyGrid.TableDescriptor.Columns[0].ItemTemplate; this.DynamicGrid.TableDescriptor.Columns[2].ItemTemplate = desiredTemplate; And then hide the dummy grid, of course. You can in fact reuse a single template across different columns - since the logic that fetches the data will be based on the column in which the template gets used. Let us know if you need more help. Regards, Praveen Ramesh

Administrator [Syncfusion]
Replied On September 9, 2005 02:29 AM UTC

Do you mean by having a dummy grid with all the possible columns defined by templates, i can retrieve the required template for a column and put into the actual grid to be displayed? Does that means that if i have thousands of columns, my dummy grid will be huge? Thanks

Administrator [Syncfusion]
Replied On September 9, 2005 03:00 AM UTC

Also, in this case do i have to change the code whenever there is an addition of a new column that i wish to display on the grid?

Administrator [Syncfusion]
Replied On September 9, 2005 06:28 PM UTC

Hi Quek Here is a modified version of the EditAllRows sample where you can dynamically change the number of columns. You can unzip this sample to the \Program Files\Syncfusion\Essential Studio\3.3.0.0\Web\Grid.Grouping.Web\Samples\1.1\Editing directory and create virtual directories pointing to the appropriate cs\vb sample directory and then try building and running this sample. Enter the number of columns and click on the Update Grid Button to dynamically change the number of columns. Do not hesitate to contact us if you have any further questions. Regards Arun

Administrator [Syncfusion]
Replied On September 9, 2005 06:34 PM UTC

Hi Quek Try this link instead to download the sample. Sorry for the inconvenience. Regards Arun

Administrator [Syncfusion]
Replied On September 13, 2005 07:01 PM UTC

Hi Quek, This sample demonstrates how to connect to different tables dynamically and also use different types of templates for different fields based on the field type. When the user adds a new column, the grid’s data binding has to be basically reset (as if it’s going to bind to a new table), then the new column can also be edited. This is not illustrated, if you need help with this do not hesitate to contact us. Regards Arun

Administrator [Syncfusion]
Replied On September 14, 2005 01:31 PM UTC

Hi Arun, Are you saying that if i have a new column in my database i have to personally reset the binding? Or can it all be automated?

Administrator [Syncfusion]
Replied On September 14, 2005 02:23 PM UTC

Yes, when a new column gets added to the database, the cleanest way is to rebind the grid to the datasource. In the attached sample, you would implement the logic like this: // Let''s say this is the event that will cause one or more columns to be added to the currently bound table. // Let''s say this is the event that will cause one or more columns to be added to the currently bound table. // Let''s say this is the event where a new column gets added to the table: private void Some_Event(object sender, System.EventArgs e) { // Add new columns to the table. // ... (Code for this goes here) // Then call this method: to refresh the grid''s databinding // Code for this method is in the sample. this.UpdateGridsDataSource(); } Regards, Praveen

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon

;