tunggal jaya
tunggal jaya

Reputation: 1

How to formatstring totalrow in gridex janus

i have some problem in gridex janus

  1. how to format string the total row in gridex
  2. how to set value in totalrow

thanks

Upvotes: 0

Views: 2998

Answers (2)

Phan Xuan Truong
Phan Xuan Truong

Reputation: 1

  1. Hi! i have same question and find out result:

GridEX.RootTable.Columns("YourColumnsName").TotalFormatString = "N0"

0 is odd number

too late but hope can be useful for another person. :)

Upvotes: 0

Will Marcouiller
Will Marcouiller

Reputation: 24132

As to set the value in total row, you have to set the aggregate function, which I don't know whether you're aware of. Here's an example, for the sake of comprehensiveness.

GridEX.TotalRow = InheritableBoolean.True
GridEX.RootTable.Columns("MyColumn").AggregateFunction = AggregateFunction.Count

As for the aggregate function to choose, simply select the one you require among those available.

As for formatting the string for the total row, I am still looking for this information myself. I'll update as soon as I get the details.

And by the way, here are some other questions from which you might find the information about the formatting options, here on SO: https://stackoverflow.com/questions/tagged/gridex, in case it helps meanwhile.

EDIT

When you wish to customize the total row cells content, you ought to aggregate the summary manually through your GridEX's DataSource, for example, or through the RowCount property if you simply wish a count.

When you initialize your GridEX control, you have to set the TotalRow to the appropriate value as shown above. Then, implement the FormattingRow as follows.

private void GridEX_FormattingRow(Object sender, RowLoadEventArgs e) {
    var r = e.Row
    if (r.RowType == RowType.TotalRow) r.Cells("MyColumn").Text = String.Format("{0} elements", GridEX.RowCount);
}

So, all you have to do is to get a grip on your DataSource, may it be an IList<T>, then aggregate according to your needs, then set the Text property of the appropriate cell of your total row.

You're done!

Hope this helps!

Upvotes: 1

Related Questions