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.
Syncfusion Feedback

GridGroupingWeb - Set columns readonly

Thread ID:

Created:

Updated:

Platform:

Replies:

51861 Nov 15,2006 01:35 PM UTC Dec 13,2006 02:42 PM UTC ASP.NET Web Forms (Classic) 28
loading
Tags: GridGroupingControl
Administrator [Syncfusion]
Asked On November 15, 2006 01:35 PM UTC

Hi,
I have problems to set columns of my GridGroupingControl to readonly.

I've tried these ways:
- In GridGroupingControl1_QueryCellStyleInfo:
if (e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record && e.TableCellIdentity.Column != null
&& e.TableCellIdentity.Column.Name == "Nr_1")
{
e.Style.ReadOnly = true;
}
- In the TableDescriptor:
GridGroupingControl1.TableDescriptor.Columns[0].Appearance.AnyCell.ReadOnly = true;

I'm adding the columns programaticaly by
GridGroupingControl1.TableDescriptor.Columns.Add new GridColumnDescriptor("Nr_1", "Nr_1", colHeader,true);

But if I click on a row every cell gets a Textbox and the value can be changed.
What do I have to do to avoid this behavior?

Regards,
Christian

Gokul B [Syncfusion]
Replied On November 15, 2006 07:56 PM UTC

Hi Christian,

We regret for the inconvenience caused. we noticed that ReadOnly property of GridGrouping is not functioning. However we found the workaround to achieve the similar behavior, by setting the cell type as static for that column. See the below code snippet.

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{

if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
if (e.TableCellIdentity.Column.MappingName == "CustomerID")
{
//Makes the cell as readonly
e.Style.CellType = "Static";
}
}
}

Let us know if this helps.

we will try to fix this issue within two months.

Thanks for using Syncfusion Products.

regards,
B.Gokulkumar



Administrator [Syncfusion]
Replied On November 16, 2006 10:42 AM UTC

Thanks, that's working.

But now I'm struggling with another problem:
My grid has set AllowNew to true. When I click on the new record line I can enter new values into the textboxes, but if I want to cancel/save I get a null-reference exeption in GridWebElements.cs on line 1074. My grid has got two primarykey cols, which I've tried to set in
GridGroupingControl1_QueryCellStyleInfo, because I thought that might be the problem, but it's still not working. Do I have to initalize the new record somewhere else?

Regards,
Christian

>Hi Christian,

We regret for the inconvenience caused. we noticed that ReadOnly property of GridGrouping is not functioning. However we found the workaround to achieve the similar behavior, by setting the cell type as static for that column. See the below code snippet.

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{

if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
if (e.TableCellIdentity.Column.MappingName == "CustomerID")
{
//Makes the cell as readonly
e.Style.CellType = "Static";
}
}
}

Let us know if this helps.

we will try to fix this issue within two months.

Thanks for using Syncfusion Products.

regards,
B.Gokulkumar



Gokul B [Syncfusion]
Replied On November 17, 2006 08:47 PM UTC

Hi Christian,

Sorry for delay in getting back to you.

Still we couldn't able to reproduce this issue. we need to investigate bit more on that and let you know later today.

Thanks,
B.Gokulkumar

Gokul B [Syncfusion]
Replied On November 18, 2006 01:19 AM UTC

Hi Christian,

We tried a lot to reproduce the issue. But we couldnt able to reproduce the issue as you mentioned. So could please update us with more information reg this issue or send us the sample which causes this issue. It will help us to come up with solutions.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Administrator [Syncfusion]
Replied On November 20, 2006 04:31 PM UTC

Hi,
I've put the aspx- & codebehind file to the attachement of this post. I'll hope this helps to discover the problem.

Thanks & Regards,
Christian

grid_page.zip

Gokul B [Syncfusion]
Replied On November 20, 2006 10:08 PM UTC

Hi Christian,

Thanks for your attachment. We need to look bit more on that and get back to you in another "2" days.

Thanks for using Syncfusion Products.

regards,
B.Gokulkumar

Gokul B [Syncfusion]
Replied On November 21, 2006 11:31 PM UTC

Hi Christian,

Sorry for the delay in getting back to you. We faced some problem while trying to reproduce the issue in your sample. Problem is, we are unable to run your sample because you have even used other products than Syncfusion.

so could you please update us with another sample with same scenario and also update us with stack trace info in your next post. It will help us for further investigation.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Administrator [Syncfusion]
Replied On November 28, 2006 04:53 PM UTC

Hi,
i've put an example page which should run without any other resources than Syncfusion.

I hope you'll find the problem, because I've to finish my project soon and inserting new rows is very essential for my application.

Thanks & Regards
Christian

>Hi Christian,

Sorry for the delay in getting back to you. We faced some problem while trying to reproduce the issue in your sample. Problem is, we are unable to run your sample because you have even used other products than Syncfusion.

so could you please update us with another sample with same scenario and also update us with stack trace info in your next post. It will help us for further investigation.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar


test53.zip

Gokul B [Syncfusion]
Replied On November 29, 2006 12:46 AM UTC

Hi Christian,

We could reproduce the issue as you mentioned with your sample. It is bit hard to get resolved, however we will update you within 2 days time period.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Gokul B [Syncfusion]
Replied On November 30, 2006 05:03 PM UTC

Hi Christian,

We checked for a while, but still we are not sure why this error occurs. so we have attached a sample which will bind the grid to datasets with addnew row functionality. Please download the sample by clicking the link below, and do let us know if you are able to reproduce the error in this sample

Bindingtodataset_forum52199.zip

Here are some suggestion. In your application instead of using Generic Dictionary DataTable try DataSet.I think this might cause the issue, but we are not sure this causes the issue.

Dictionary TabDataSource = null;

instead try

Dictionary TabDataSource = null;

Let us know if this helps.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Administrator [Syncfusion]
Replied On November 30, 2006 07:21 PM UTC

Hi B.,
I'm not very happy with the 'workaround' to use datasets, because our application sometimes have large amounts of data and datasets are known to slow down the application in this case.
I started with GridGroupingWeb and wanted to use TypedLists, that was not working correctly, you confirmed it as a bug, then I redesigned my application to use DataTables and now again (after some hours of searching the error on my site) you tell me that I can't use DataTables.
I think you may understand, that I'm not so happy about this.
I've a few days left to finish my application, so I hope that you will find the problem, otherwise I'll have to use the datasets.

Regards,
Christian

Gokul B [Syncfusion]
Replied On December 1, 2006 04:16 PM UTC

Hi christian,

We are currently looking into this and will update you on or before Tuesday.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Gokul B [Syncfusion]
Replied On December 4, 2006 03:53 PM UTC

Hi Christian,

We do support DataTable for our GridGrouping control, please have a look at the below sample which supports DataTable and Add New row. we are also looking in to your sample on where could be the issue is.

hierarchysample.zip

In the mean time could you please look at this forum(http://www.syncfusion.com/support/forums/message.aspx?&MessageID=52199) where similar issue is discusses.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Administrator [Syncfusion]
Replied On December 5, 2006 09:26 AM UTC

Hi B.,
thanks for the sample, I used this already to build up my page. I've also seen the other forum with the similar or same problem already. I've forgotten to mention that I often get the following error when I fill the grid for the first time and want to drill down to a child table. When I refresh the page and do exactly the same steps it's working ?! Perhaps that error results of the same problem.

Regards,
Christian

Server Error in '/macsWeb' Application.
--------------------------------------------------------------------------------

'Element' is an invalid XmlNodeType. Line 1, position 2045.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: 'Element' is an invalid XmlNodeType. Line 1, position 2045.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[XmlException: 'Element' is an invalid XmlNodeType. Line 1, position 2045.]
System.Xml.XmlReader.ReadEndElement() +1914470
Syncfusion.Styles.StyleInfoStore.ReadXml(XmlReader r) +540
Syncfusion.Styles.StyleInfoBase.ReadXml(XmlReader reader) +41
System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable) +15
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderGridEngine.Read33_GridTableCellAppearance(Boolean isNullable, Boolean checkType) +9337
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderGridEngine.Read37_GridColumnDescriptor(Boolean isNullable, Boolean checkType) +2353
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderGridEngine.Read41_GridTableDescriptor(Boolean isNullable, Boolean checkType) +13166
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderGridEngine.Read31_GridRelationDescriptor(Boolean isNullable, Boolean checkType) +2221
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderGridEngine.Read41_GridTableDescriptor(Boolean isNullable, Boolean checkType) +10448
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderGridEngine.Read31_GridRelationDescriptor(Boolean isNullable, Boolean checkType) +2221
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderGridEngine.Read41_GridTableDescriptor(Boolean isNullable, Boolean checkType) +10448
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderGridEngine.Read43_GridEngine(Boolean isNullable, Boolean checkType) +4989
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderGridEngine.Read44_GridEngine() +132

[InvalidOperationException: There is an error in XML document (1, 2045).]
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +637
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) +32
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader) +6
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.ApplyXmlSchema(XmlReader xr) +105
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.LoadViewState(Object savedState) +315
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +251

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +358
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +17
Syncfusion.Web.UI.WebControls.CallbackControlEnabler.ViewStateToLoad(Object state) +181
Syncfusion.Web.UI.WebControls.CallbackControlEnabler.LoadViewState(Object savedState) +229
Syncfusion.Web.UI.WebControls.CallbackDataBoundControl.LoadViewState(Object savedState) +77
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.LoadViewState(Object savedState) +61
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +251
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Page.LoadAllState() +520
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3444

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

Gokul B [Syncfusion]
Replied On December 5, 2006 09:38 PM UTC

Hi Christian,

We couldn't reproduce the issue as you mentioned. So we have attached a sample which will bind the grid to dataset from XML file. Please download the sample by clicking the link below, and do let us know if you are able to reproduce the error in this sample.

XML_51861.zip

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Administrator [Syncfusion]
Replied On December 6, 2006 08:05 AM UTC


Hi,
i've tried the sample with version 4.402.0.46, and it's all working fine as long as I don't try to enter something into a new row. After I've inserted the values into the textboxes I see the "Refreshing.." in the status bar and that's it, now the grid is not working properly any more as long as I don't reload the whole page.

Regards,
Christian



>Hi Christian,

We couldn't reproduce the issue as you mentioned. So we have attached a sample which will bind the grid to dataset from XML file. Please download the sample by clicking the link below, and do let us know if you are able to reproduce the error in this sample.

XML_51861.zip

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Administrator [Syncfusion]
Replied On December 6, 2006 08:09 AM UTC

I just looked into my events and found this error:

Prozessinformationen:
Prozess-ID: 5652
Prozessname: WebDev.WebServer.EXE
Kontoname: CS18C2D\Christian

Ausnahmeinformationen:
Ausnahmetyp: InvalidOperationException
Ausnahmemeldung: AddNew not called

Anforderungsinformationen:
Anforderungs-URL: http://localhost:1115/XML_51861/Default.aspx
Anforderungspfad: /XML_51861/Default.aspx
Benutzerhostadresse: 127.0.0.1
Benutzer: CS18C2D\Christian
Ist authentifiziert: True
Authentifizierungstyp: NTLM
Threadkontoname: CS18C2D\Christian

Threadinformationen:
Thread-ID: 8
Threadkontoname: CS18C2D\Christian
Identitätswechsel für: False
Stapelüberwachung: bei Syncfusion.Grouping.AddNewRecord.SetValue(FieldDescriptor fieldDescriptor, Object value)
bei Syncfusion.Web.UI.WebControls.Grid.Grouping.GridAddNewRecord.Syncfusion.Web.UI.WebControls.Grid.Grouping.IGridTableCellStyleChanged.RaiseTableCellStyleChanged(GridTableCellStyleInfoEventArgs e)
bei Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoIdentity.OnStyleChanged(StyleInfoBase style, StyleInfoProperty sip)
bei Syncfusion.Styles.StyleInfoBase.OnStyleChanged(StyleInfoProperty sip)
bei Syncfusion.Windows.Forms.Grid.GridStyleInfo.OnStyleChanged(StyleInfoProperty sip)
bei Syncfusion.Styles.StyleInfoBase.EndUpdate()
bei Syncfusion.Windows.Forms.Grid.GridCellModelBase.ApplyFormattedText(GridStyleInfo style, String text, Int32 textInfo)
bei Syncfusion.Windows.Forms.Grid.GridStyleInfo.ApplyFormattedText(String text, Int32 textInfo)
bei Syncfusion.Windows.Forms.Grid.GridStyleInfo.set_FormattedText(String value)
bei Syncfusion.Web.UI.WebControls.Grid.Grouping.GridCell.SetValue(String modifiedText)
bei Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTextBoxCell.textBox_TextChanged(Object sender, EventArgs e)
bei System.Web.UI.WebControls.TextBox.OnTextChanged(EventArgs e)
bei System.Web.UI.WebControls.TextBox.RaisePostDataChangedEvent()
bei System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent()
bei System.Web.UI.Page.RaiseChangedEvents()
bei System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Administrator [Syncfusion]
Replied On December 6, 2006 01:07 PM UTC

The exception I described above is only thrown when I try to edit the new row in a child table. In the root table I can insert the new values and set the context into another row.

Regards,
Christian

Administrator [Syncfusion]
Replied On December 6, 2006 04:58 PM UTC

Hi,
I also replaced my Dictonary of DataTables now with a DataSet and bound it to the Grid as you do it in your examples of this forum. But I still get exactly the same error "Object reference not set to an instance..." in the file GridWebElements.cs on line 1074 because the Record r which is passed as a parameter to GetRecordId() contains no values at all. r.Kind is "Record" but I think it should be "DisplayElementKind.AddNewRecord".

A difference of your example and my application is that im not adding the RelationDescriptors every time in Page_Init but use GridGroupingControl1.Engine.InitializeFrom(x) as I found it in another forum here. Might this be a problem?

Christian

Gokul B [Syncfusion]
Replied On December 6, 2006 06:46 PM UTC

Hi christian,

We regret for the delay.
We are currently looking into this and will get back to you later today.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Gokul B [Syncfusion]
Replied On December 7, 2006 12:23 AM UTC

Hi Christian,

Kindly accept my sincere apology for this delay.

We need to look bit more on that and get back to you in another "2" days.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar


Administrator [Syncfusion]
Replied On December 7, 2006 07:42 PM UTC

Hi B,
it seems to work now - I have read the other forum again and saw that the DataSource has to be set to a DataSet and not to the "parent" DataTable as you do it in all your examples attached in this forum.

My AddNew - Row has got a ComboBox-Column, where the user may select items. Can you tell me, how I can get the value or the selectedindex of the combo box when saving the new row? I haven't found how to do this in the examples and doc.

Thanks & Regards,
Christian

Administrator [Syncfusion]
Replied On December 8, 2006 08:35 PM UTC

Hi Christian,

Glad that you got it working!. Regarding the Combobox in add new row, we will update you on Monday.

Best regards,
Siva

Administrator [Syncfusion]
Replied On December 11, 2006 03:59 PM UTC

Hi Siva,
it seems to be a problem if I don't change the selected comboxbox item. If I do select another item I can read the value in the "CurrentRecordContextChange" event in the "EndEditComplete" case.

Another problem with the combobox type in the new record is that the grid crashes after I bound data to it for the first time. Then I have to reload my site and after that I can work without the error coming up again. When I don't use the combobox in the new record I don't have this problem. So I think I'm doing something wrong here. Can you give detailed information on how and where I have to set the datasource etc. for this combobox?

Regards,
Christian

Administrator [Syncfusion]
Replied On December 11, 2006 10:49 PM UTC

Hi Christian,

we regret for delay.

Still we are struggling to get resolved this issue. So we need to look bit more on that and let you know later tommorrow.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Gokul B [Syncfusion]
Replied On December 12, 2006 06:04 PM UTC

Hi Christian,

We can able to reproduce the issue as you mentioned. We noticed that we can't able to read the value from Combobox when we didn't change the selected combobox item. We will try to fix this bug very soon. However, please have look at the below code snippet as temporary workaround.

GridGroupingControl1.TableDescriptor.Columns[0].Appearance.AddNewRecordFieldCell.CellType = "ComboBox";
StringCollection rows = new StringCollection();
//Points to first index of combobox item. Does nothing even if it is got selected.
rows.Add("--Select--");
rows.Add("34"); rows.Add("11"); rows.Add("21");
GridGroupingControl1.TableDescriptor.Columns[0].Appearance.AddNewRecordFieldCell.DataSource = rows;

Let us know if this helps.

Could you please explain us more regarding your another problem. It will helps us to come up with solution

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

Administrator [Syncfusion]
Replied On December 13, 2006 07:54 AM UTC

Hi,
I'm using Templates for this column now and don't have the error any more.

Regards,
Christian

Gokul B [Syncfusion]
Replied On December 13, 2006 02:42 PM UTC

Hi Christian,

Thank you for your Update.

Let us know if you need any other assist.

Thanks for using Syncfusion products.

regards,
B.Gokulkumar

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.

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

;