Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
8920
formatting cells dynamically
posted

I am working on bringing applications with older components to the 2020.1 fold ..  I have the following problem that I need to resolve.

On one hierarchical grid there is a need to format cells as the underlying data is floating point but only one row actually need to show decimals while the rest of the data should be whole numbers…. In an old application that was addressed by assigning delegate to the GridView.Columns[i].FormatFieldMethod that actually return the correct formatting string.   It worked fine.. In new components it blows up if data on the grid was updated… If you can have a look and advise how to address the issue.   

Here steps to recreate :

  1. Run pj on the lr4Data.aspx it will show the grid on the page.. All underlying data is decimal but only ‘TAXRATE’ row shows values as decimals 

         

        2. Click Post button, page get reposted, all the same.

       3. Change some value in the a5 or a6 column on the main grid. It blows up, as somehow the lr4whdg reference is not there .. it also                  skips lr4whdg_RowUpdating event.. It does not skip it and works fine if data on the child grid updated.. 

WHG.zip

Parents
  • 1320
    Offline posted

    Hello Michael,

    After investigating this further, I determined that the behavior is observed because the currentRow variable gets higher than the number of rows in the grid. What I could suggest is checking whether the row with index currentRow is not null in the FormatTotalField method as follows:

    protected string FormatTotalField(ControlDataField field, object val)

            {

           if (this.lr4whdg.Rows[currentRow]!= null && (string)this.lr4whdg.Rows[currentRow].Items[1].Value == "TAXRATE")

                    {

                         . . .

                    }

         }

    Additionally the “RowUpdatingEvent” is fired when the Post_Back takes place, which is the default behavior when BatchUpdating is enabled.

    Please let me know if you need any further information regarding this matter.

    Regards,

    Monika Kirkova,

    Infragistics

Reply Children