Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hi,

                                    I'm using GridView MVC Extension; and I need add row values like I'm adding column values. I'm adding rows with this line:

                                    settings.Columns.Add(xmlnode.Attributes["value"].Value);

                                    But how can I add row values like this?

                                    I need this feature because I store XML nodes from a single model property in the view. System.Xml.XmlNodeList[] nodes = Model.XMLs.Nodes;

                                    Then I loop the xml string with a foreach structure for retrieve the column values. (I can add easily a column from a XMLnode; but i cannot do the same with cells/rows). I'm in a foreach structure


                                    foreach (System.Xml.XmlNodeList node in nodes)
                                    {
                                    DateTime ms = DateTime.Now;
                                    Html.DevExpress().GridView(gw => {
                                    gw.Name = "myGridView" + ms.Millisecond;//different grid name (fast solution)
                                    gw.Width = 450;
                                    foreach (System.Xml.XmlNode n in node) {
                                    if (xmlnode.Attributes["row"].Value == "0") {//If, while in the foreach loop; in the xml XmlNodeList, there is value 0 in row property....
                                    gw.Columns.Add(xmlnode.Attributes["value"].Value);//We have to Add new column!
                                    } else {/
                                    //Here I must add row values :S
                                    }
                                    }
                                    }).GetHtml();
                                    }


                                     

                                    Thanks.

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hello,

                                I would like to note that the GridView just shows data from a datasource. It is impossible to add a row or cell manually.
                                In your case, I see two solutions:
                                - Rewrite the text of existent cells that belong to the GridView. Use the GridViewSettings.CustomColumnDisplayText delegate for this;
                                - Bind the GridView to a Model that already has all required modifications.

                                You must  log in  or  register  to leave comments

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners