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.

Problems while trying to perform edit on GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

66566 Jul 31,2007 12:45 AM Aug 10,2007 05:25 AM ASP.NET Web Forms (Classic) 6
loading
Tags: GridGroupingControl
sowmya
Asked On July 31, 2007 12:45 AM

Hi,

We are using syncfusion 5.0 version Essential Grid Grouping control in ASP.Net 2.0(C#), web application.

Our requirement is to allow the user to enter data through the GridGroupingControl.
The data source which I am using is a dynamically generated data table and I need to update this when the user enters
The data and clicks on enter key.


protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
DataColumn dc1 = new DataColumn("Column1");
DataColumn dc2 = new DataColumn("Column2");
DataColumn dc3 = new DataColumn("Column3");

dt.Columns.Add(dc1);
dt.Columns.Add(dc2);
dt.Columns.Add(dc3);

DataRow dr = dt.NewRow();
dt.Rows.Add(dr);

GridGroupingControl1.DataSource = dt;
this.GridGroupingControl3.TableDescriptor.Columns[0].MappingName = " Column1";
this.GridGroupingControl3.TableDescriptor.Columns[1].MappingName = " Column2";
this.GridGroupingControl3.TableDescriptor.Columns[2].MappingName = " Column3";
GridGroupingControl3.DataBind();
}

I have tried using the CurrentRecordContextChange event but the action EndEditCalled is never fired.

I have used the following code to add the drop down box dynamically into the second column of the grid

GridTableCellStyleInfo style = GridGroupingControl1.TableDescriptor.Columns[1].Appearance.AnyRecordFieldCell;
style.DataSource = ds;
style.ValueMember = "country";
style.DisplayMember = "country";
style.CellType = "ComboBox";

How can I update the data and into the data table with corresponding selection made in the dropdown box and how can I fire
ItemSelectionChanged event for this dropdown box

Another question as well how do I find out the value that is enered in a particular column of the grid.

Hoping for an early reply
Thanks,
Sowmya

sowmya
Replied On July 31, 2007 12:47 AM

We are making use of VS 2005

Valli [Syncfusion]
Replied On August 2, 2007 06:07 AM

Hi Sowmya,

Thank you for choosing Syncfusion products.

Please refer the below update to your queries:

1. Sample:

Below is the sample link which contains the modified code according to the 5.1 version.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/Forum-66566/main.htm

There is no need to use the code,

GridGroupingControl3.DataBind();

Once on defining the DataSource property, the Grid gets binded to the corresponding DataSource.

2. I have tried using the CurrentRecordContextChange event but the action EndEditCalled is never fired:

Please refer the below sample link in which the 'EndEditCalled' fired on the CurrentRecordContextChange event.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/Forum-64541-1/main.htm

In the sample the once the 'EndEditCalled' action is completed the Server side event GridGroupingControl1_CurrentRecordContextChange will help you to get the details of the Edited record as well as AddNew records.

3. Adding dropdownlistbox dynamically into the second column of the grid:

Could you please let us is your requirement is to add dropdownlistbox at the time of editing?

If your requirement is to add the template during the time of editing the below information will help you,

i. You can change the celltype of the column to 'ComboBox' if you want the dropdown to be displayed while editing.

Below is the sample link which will shown the dropdownlist on the column while editing.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/Incident-35505/main.htm

The records enters into editable mode on double clicking it. The 'CellType' of the 'City' field is set to 'ComboBox'. The 'ComboBox' is binded to the DataSource.

ii. You can also use templates at the runtime and design to add dropdownlistbox.

4. Firing the ItemSelectionChanged event for the dropdownlistbox:

The below code which is placed in the 'QueryCellStyleInfo' will help you to fire the 'SelectedIndexChanged' event.

if (e.TableCellIdentity.Column.Name == "Column2")
{
//Changes the EditItem template of the column specified as DropDownListBox
DropDownList dropdown = new DropDownList();
dropdown.Items.Add("None");
dropdown.Items.Add("Row0");
dropdown.Items.Add("Row1");
dropdown.Items.Add("Row2");
dropdown.Items.Add("Row3");
dropdown.Items.Add("Row4");
dropdown.AutoPostBack = true;
dropdown.SelectedIndexChanged += new EventHandler(dropdown_SelectedIndexChanged);
//Here we adding the DropDownListBox programatically using ITemplate Interface
TemplateClass mytemp = new TemplateClass(dropdown);
e.TableCellIdentity.Column.EditItemTemplate = mytemp;
}

5. Save changes to the DataTable.

You can use 'CurrentRecordContextChange' event to save the changes to the datatable.

6. How do I find out the value that is entered in a particular column of the grid?

To find out the updated values[edited values], you can use the 'CurrentRecordContextChange' event.

The below sample helps you to achieve the same.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/Forum-64541-1/main.htm

Please let us know if you have any other queries.

Regards,
Valli





Spoorthi
Replied On August 3, 2007 08:43 AM

Hi,

Thank you very much for your reply.

But in the example http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/Forum-66566/main.htm
When I select some item in the combo box it is showing the message that selected index fired. But I need to see the item what ever I have selected. Now it is showing always 'none' first item after each load. So please suggest me how to retain the selected value after page resfresh.

>Hi Sowmya,

Thank you for choosing Syncfusion products.

Please refer the below update to your queries:

1. Sample:

Below is the sample link which contains the modified code according to the 5.1 version.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/Forum-66566/main.htm

There is no need to use the code,

GridGroupingControl3.DataBind();

Once on defining the DataSource property, the Grid gets binded to the corresponding DataSource.

2. I have tried using the CurrentRecordContextChange event but the action EndEditCalled is never fired:

Please refer the below sample link in which the 'EndEditCalled' fired on the CurrentRecordContextChange event.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/Forum-64541-1/main.htm

In the sample the once the 'EndEditCalled' action is completed the Server side event GridGroupingControl1_CurrentRecordContextChange will help you to get the details of the Edited record as well as AddNew records.

3. Adding dropdownlistbox dynamically into the second column of the grid:

Could you please let us is your requirement is to add dropdownlistbox at the time of editing?

If your requirement is to add the template during the time of editing the below information will help you,

i. You can change the celltype of the column to 'ComboBox' if you want the dropdown to be displayed while editing.

Below is the sample link which will shown the dropdownlist on the column while editing.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/Incident-35505/main.htm

The records enters into editable mode on double clicking it. The 'CellType' of the 'City' field is set to 'ComboBox'. The 'ComboBox' is binded to the DataSource.

ii. You can also use templates at the runtime and design to add dropdownlistbox.

4. Firing the ItemSelectionChanged event for the dropdownlistbox:

The below code which is placed in the 'QueryCellStyleInfo' will help you to fire the 'SelectedIndexChanged' event.

if (e.TableCellIdentity.Column.Name == "Column2")
{
//Changes the EditItem template of the column specified as DropDownListBox
DropDownList dropdown = new DropDownList();
dropdown.Items.Add("None");
dropdown.Items.Add("Row0");
dropdown.Items.Add("Row1");
dropdown.Items.Add("Row2");
dropdown.Items.Add("Row3");
dropdown.Items.Add("Row4");
dropdown.AutoPostBack = true;
dropdown.SelectedIndexChanged += new EventHandler(dropdown_SelectedIndexChanged);
//Here we adding the DropDownListBox programatically using ITemplate Interface
TemplateClass mytemp = new TemplateClass(dropdown);
e.TableCellIdentity.Column.EditItemTemplate = mytemp;
}

5. Save changes to the DataTable.

You can use 'CurrentRecordContextChange' event to save the changes to the datatable.

6. How do I find out the value that is entered in a particular column of the grid?

To find out the updated values[edited values], you can use the 'CurrentRecordContextChange' event.

The below sample helps you to achieve the same.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/Forum-64541-1/main.htm

Please let us know if you have any other queries.

Regards,
Valli





sowmya
Replied On August 6, 2007 09:24 AM

Hi,

Thanks for your reply. We tried using the examples that you suggested, but faced a few problems.

1. The SelectedIndex_Changed event does not get fired when I select a particular value. We are using Master Page.

2. On selection of a particular value, the page gets refreshed and the value displayed is not the selected one but the first value in the list. Do we need to explicitly assign the value every time the page loads?

3. We need to populate the second column on basis of the value selected from the first column. We need to do it in the SelectedIndex_Changed event. How to achieve this?

4. If a user tabs out or presses enter from the last column the current row needs to be saved and a new row needs to be added to the grid.

5. When we enter some text on other textbox columns and select the dropdown list then it is giving error
"Object reference not set to an instance of an object".

Attached is the source for your reference:

Hoping for an early reply
Thanks,
Sowmya

Syncfusion_Grid_Problem.zip

sowmya
Replied On August 10, 2007 02:50 AM

Hi Valli,

We were facing a few issues with the sync fusion grid. We posted these issues as seen above, but there is no response from your end. We are unable to proceed further in our development because of these issues. Please look into the issues and reply.
If syncfusion grid is unable to handle these issues we might have to choose another grid to handle our requirements.

thanks.

Melba Winshia [Syncfusion]
Replied On August 10, 2007 05:25 AM

Hi Sowmya,

Sorry for the delay in responding.

Issue 1: (SelectedIndex_Changed event does not get fired in Master page)
--------

We have identified this issue of "SelectedIndex_Changed event does not get fired in Master page" to be a defect and we thank you for bringing this to our attention. To facilitate tracking the progress of the fix, and timely resolution, we request you to create an incident in our incident database Direct Trac. Our development team would be able to determine the fix and alert you with the service pack download details as soon as they are made available.

Issue 2 and 3: (the page gets refreshed and the value displayed is not the selected one)
-------

We have identified this issue of "On selection of a particular value, the page gets refreshed and the value displayed is not the selected one" to be a defect and we thank you for bringing this to our attention. To facilitate tracking the progress of the fix, and timely resolution, we request you to create an incident in our incident database Direct Trac. Our development team would be able to determine the fix and alert you with the service pack download details as soon as they are made available.

Issue 4: (If a user presses enter from the last column, a new row needs to be added)
-------

I am working on this issue. I will update you regarding this issue with in one business day.

Issue 5: (Object reference not set to an instance of an object)
--------

I am afraid that I was not able to reproduce the issue. Please refer to the following steps that I tried to reproduce it.

1. Run the sample
2. Enter some text on other textbox columns
3. Select the dropdown list
4. But no exception

Also I have created a simple sample to test this issue with Master page and it is available in the following link.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/66566/main.htm

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample or send us the reproducing steps so that we could sort out the cause of the issue and provide you a solution?

Kindly let me know if you have any other questions.

Thanks,
Melba


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.

;