HOSTING ONLY - FpSpread DataSource Case Not Preserved

Posted by: wesley.murphree on 11 May 2020, 1:44 pm EST

  • Posted 11 May 2020, 1:44 pm EST

    .NET Framework 4.5.2
    OS: Windows Server 2012 RS Standard
    IIS: 6.2
    Application Pool: .NET CLR Version v.4.0.30319
    Managed Pipeline Mode: Integrated

    Spread.NET Version: 11.45.20183.0

    NOTES: The problem below ONLY occurs when hosted in IIS. It does NOT occur when hosted through IIS Express (v.10.0.18362.1). I'm able to debug this problem while attaching to the running IIS process ID from Visual Studio.

    ISSUE:
    We have some logic that checks for changes in the Datasource that has been bound to the FpSpread control. If changes are detected when this fall into additional logic to process those changes. There are no problems with the code detecting changes; however, there is a problem with the result returned.

    Example Code:

    public static DataTable getUpdatedGrid(FpSpread FpExcel, DataTable beforeDt)
    {
    FpExcel.SaveChanges();
    if (FpExcel.Columns.Count == beforeDt.Columns.Count)
    {
    // No added headers. HasChanges does not track added headers.
    if (((DataSet)FpExcel.DataSource).HasChanges())
    {
    DataTable changes = ((DataSet)FpExcel.DataSource).GetChanges().Tables[0];

    etc...


    The code works as expected, it detects the change and makes it to the "DataTable changes" statement. The only problem is the value doesn't reflect the changes the user made. If the user tries to change a cell from "Click" to "click" the "HasChanges" condition will evaluate to "true"; however, the value remains "Click."

    Below is a screenshot where the user attempted to change a cell value from "False" to "false". As you can see the case was preserved and not altered.



    Please let me know if there any additional information I can provide to help diagnose this issue.

    Thanks,
    Wes
  • Replied 11 May 2020, 2:01 pm EST

    I'm unable to find out how to edit my OP.

    I've also asked this question on stackoverflow. URL below...

    https://stackoverflow.com/questions/61743021/hosting-only-fpspread-datasource-font-case-not-preserved

    I'll be sure to keep both post updated.
  • Replied 12 May 2020, 4:24 pm EST

    Hi Wesley,
    We are sorry for the delayed response on this. We are trying to replicate the issue at our end but we are unable because of the incomplete code.

    Please find the attached project and modify the sample depicting your issue so that we may investigate it at our end.

    Also, if we understand correctly when the project is executed using VisualStudio, it works fine but you are facing issues with the hosted application.

    Please confirm.

    Regards,
    Manish Gupta

    Spread-GetUpdatedData.zip
  • Replied 13 May 2020, 6:47 am EST

    Manish Gupta,

    Thanks for the response and attached solution. You are correct in saying your solution works as expected. I saw similar results so I started to compare what you provided to the code in our solution. The only noteworthy difference I found is how assets are being pulled to the client.

    Spread-GetUpdatedData.zip Example:


    My Solution Example:


    If I remove the "fp_client\fpspread\11_45_20184_0" directory from my solution or from the web-server hosting my solution I will get 404s for these assets and the FpSpread control will not render correctly. My solution does not pull down FpSpread assets as an AXD file.

    Why is it your solution delivers these assets as Webresources and mine is expecting me to include the asset directory?

    I'm not sure if this is or is not related to my problem but as I stated before it's the only real difference I can see.
  • Replied 13 May 2020, 3:26 pm EST

    Scratch my previous post. I was able to figure it out by looking through an old developer guide. Basically I just needed to remove the webappsetting for fp_client.

    Unfortunately this change didn't resolve my issue. I'll continue to look through this and let you know what I find.
  • Replied 13 May 2020, 7:46 pm EST

    Hi Wesely,
    Could you please update the sample depicting your issue so that we may replicate the issue at our end and assist you accordingly?

    Regards,
    Manish Gupta
  • Replied 14 May 2020, 8:07 am EST

    Manish Gupta,

    We found the cause and a solution. After looking at additional instances of published code it turns out that this issue is somewhat intermittent, but it seemed to be fairly consistent when cell values equal True or False.

    The only significant difference between your solution and ours was how the data was being bound. In our solution we were doing a lot of cell formatting prior to binding. Part of this logic involved setting the CellType for all columns to TextCellType, example below.


    TextCellType txt = new TextCellType();
    txt.AllowWrap = false;
    txt.Multiline = true;
    FpExcel.Columns[0, FpExcel.Columns.Count - 1].CellType = txt;


    This code works but it gave us the false assumption that this "type" wouldn't be overridden by any other logic.


    Apparently this assumption turned out to be somewhat incorrect as it seems like cells with a certain value intermittently have their changes suppressed, as mentioned above with True/False. This lead us to the DataAutoCellTypes method, which by default is True. By setting DataAutoCellTypes to False, using the statement below, our issue disappeared.


    FpExcel.Sheets[0].DataAutoCellTypes = false;


    Thanks again for providing an example solution. It helped a lot in tracking this down.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels