This is a migrated thread and some comments may be shown as answers.

How to edit custom footer

1 Answer 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kristjan Einarsson
Top achievements
Rank 1
Kristjan Einarsson asked on 07 Feb 2012, 12:53 PM
Hi, I'm not sure if I am on track here, I hope there is an easier solution to this.
But I am trying to create an grid with footer witch has three editable rows (see attachment). My code is the following ->

private GridViewDataColumn bindColumn(string bindText, string headerAndTag, string cellText1, string cellText2, string cellText3)
        {
            GridViewFooterCell cell = new GridViewFooterCell();
            StackPanel sp = new StackPanel();
            TextBox cell1 = new TextBox() { Text = cellText1 };
            TextBox cell2 = new TextBox() { Text = cellText2 };
            TextBox cell3 = new TextBox() { Text = cellText3 };
 
            sp.Children.Add(cell1);
            sp.Children.Add(cell2);
            sp.Children.Add(cell3);
 
            GridViewDataColumn col  = new GridViewDataColumn();
            col.HeaderTextAlignment = TextAlignment.Right;
            col.DataFormatString    = "{0:N0}";
            col.TextAlignment       = TextAlignment.Right;
            col.Header              = headerAndTag;
            col.Tag                 = headerAndTag;
            col.DataMemberBinding   = new Binding(bindText) { Mode = BindingMode.TwoWay };
 
            col.Footer = sp;
            return col;
        }

My question is: Is there a better way to achieve this ? Should I perhaps use other things than TextBox ?
Can someone give me some tips.

Thank you.
Kristján

1 Answer, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 07 Feb 2012, 12:59 PM
Hello,

 Indeed adding desired UI elements using column Footer property is the right way. You should not need however creation/adding GridViewFooterCell.

Regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
Kristjan Einarsson
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or