0

I need conccat two columns

FirstName + LastName.

I need create one columnt DisplayName.

How do this? I can not do this when receiving data \ grid

 ResultGrid = new JQGrid
                {
                    Columns = new List<JQGridColumn>()
                        {
                            new JQGridColumn
                                {
                                    DataField = "ID",
                                    PrimaryKey = true,
                                    Editable = false,
                                    Visible = false,
                                },
                            new JQGridColumn
                                {
                                    DataField = "FirstName",
                                    Visible = false,
                                },
                            new JQGridColumn
                                {
                                    DataField = "LastName",
                                    Visible = false,
                                },
                            new JQGridColumn
                                {
                                    DataField = "EmployeeDisplay",
                                    Editable = false,
                                    Searchable = true,
                                    DataType = typeof(Int32),
                                    SearchToolBarOperation = SearchOperation.IsEqualTo,
                                    SearchType = SearchType.DropDown,
                                    Formatter = new CustomFormatter(){FormatFunction = ""}
                                },
                            new JQGridColumn
                                {
                                    DataField = "Date",
                                    SearchType = SearchType.DatePicker,
                                    DataType = typeof (DateTime),
                                    SearchControlID = "DatePicker",
                                    SearchToolBarOperation = SearchOperation.IsEqualTo,
                                    Editable = false,

                                },
                            new JQGridColumn
                                {
                                    DataField = "Yield",
                                    Editable = false,

                                },
                            new JQGridColumn
                                {
                                    DataField = "Credit",
                                    Editable = false
                                },
                            new JQGridColumn
                                {
                                    DataField = "Balance",
                                    Editable = false
                                },

                        },
                    Width = Unit.Pixel(1000),
                    Height = Unit.Pixel(500)
                };

data:

    var joinTransationAndEmployee = employees.Join(transaction, e => e.TimeAccountID, tl => tl.AccountID,
                             (employee, log) =>
                             new
                                 {
                                     log.ID,
                                     log.Date,
                                     log.Credit,
                                     log.Yield,
                                     log.Balance,
                                     FirstName= employee.FirstName,
                                     LastName = employee.LastName
                                 });

        return model.ResultGrid.DataBind(joinTransationAndEmployee);
Mediator
  • 14,951
  • 35
  • 113
  • 191
  • possible dublicate : http://stackoverflow.com/questions/5625325/how-to-merge-cells-in-jqgrid-4-0 and other answer that is not accepted in given link `Cell merging is currently not supported - at this point you cannot set row/colspans for different cells. This is in our backlog for the near future.` – AliRıza Adıyahşi Dec 04 '12 at 14:15
  • Why dont you do this while you receiving data? – AliRıza Adıyahşi Dec 04 '12 at 14:19
  • I can suggest many ways how the requirements could be implemented. You should describe more detailed what you do. Do you get the data per Ajax request? Which is format of the input data (for example array of items like `["First", "Last"]` or `{"FirstName": "First", LastName: "Last"}` or some another)? How is the definition of jqGrid which you use (at least `colModel` of two columns are required)? Do you has some editing feature in the grid or you need just display the column after the loading? Which `datatype` has the grid? Do you use `loadonce: true` or not? ... – Oleg Dec 04 '12 at 14:20
  • I use linq to sql, I update my post – Mediator Dec 04 '12 at 14:28
  • You use wrong tag [jqgrid](http://stackoverflow.com/tags/jqgrid/info) for the question. jqGrid is open source **JavaScript** jQuery plugin. It seems that you use *commercial* grid like [jqSuite](http://www.trirand.net/download.aspx). In the case the tag [jqgrid-asp.net](http://stackoverflow.com/tags/jqgrid-asp.net/info) is more close to your code. It's still unclear what you need. Why you not just use `{ FullName = employee.FirstName + employee.LastName}` inside of expression for `joinTransationAndEmployee`? – Oleg Dec 04 '12 at 15:35
  • this is linq to sql. there do not – Mediator Dec 04 '12 at 20:31
  • @simplydenis: You can do use "+" to build resulting properties exactly like you can use it in TSQL. If you have problems with `NULL` then you can use `??` too (see [here](http://stackoverflow.com/a/5586778/315935) for example) – Oleg Dec 04 '12 at 21:47

0 Answers0