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

[Solved] Server Detail Template and .Template Column in DetailsView

7 Answers 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ashok
Top achievements
Rank 1
Ashok asked on 21 Apr 2011, 12:17 AM
I am following example of Server Detail Template. We have some questions:
1) Can we add grid inside DetailsView without Tabstrip?
2) Inside DetailsGrid, when we load another grid, can that Grid not have  column.BoundColumn().Template() or  column.BoundColumn().ClientTemplate()

Currently when we try to add column.BoundColumn().Template(@<a href=""..... />) we get compile error..

Any solution to have "<a href />" inside DetailsView Grid?

7 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 21 Apr 2011, 07:31 AM
Hello Tejas,

This sample shows how to nest one grid into another using server binding. And this one demonstrates how to use templates.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ashok
Top achievements
Rank 1
answered on 21 Apr 2011, 02:38 PM
Nikolay,

You didn't get my question correctly. I followed demo application sample and user Server Detail Template. Inside Detail Template I want to add Template column and I get error:

Inline markup blocks (@<p>Content</p>) cannot be nested. Only one level of inline markup is allowed.

1) Is it possible to nest template column inside DetailView Grid?

0
Accepted
Nikolay Rusev
Telerik team
answered on 21 Apr 2011, 04:13 PM
Hello Tejas,

There is a blog post and documentation describing similar scenarios. For your convenience I am attaching sample project demonstrating sample implementations.

Greetings,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ashok
Top achievements
Rank 1
answered on 21 Apr 2011, 10:13 PM
Awesome !! Sample helped me a lot.

1) I am using following code to loop thro' Grid -- $("#GridName tbody > tr, #GridName .t-grid-content tbody > tr").each(function (){ });
This was working fine, but since I have Detail column inside my Grid, this code breaks (my logic) after first iteration. How do I bypass looping thro' details view?

2) However it broke javascript code I wrote to find column index. Now, even though I get correct column index, I get wrong value. Any idea why?

Here is complete code of javascript:
function GetGridColumnIndexByName(grid, colName) {
    var columnIndex = -1;
    for (var i = 0; i < grid.columns.length; i++) {
          
        var col = grid.columns[i];
         if (col.member == colName) {
            columnIndex = i;  // This is the column you are looking for. Move along.
            break;
        }
    }
  
    return columnIndex;
}

$(function () {
    $('#btnSubmit').click(function () {
        $('#mask').height(document.body.scrollHeight + 'px');
        $('#mask').show();
  
        var grid = $('#GridName').data('tGrid');
        var indexOfIdColumn = GetGridColumnIndexByName(grid, "Id");
  
        var results = new Array();
  
        $("#GridName tbody > tr, #GridName .t-grid-content tbody > tr").each(function () {
            var tr = this;
            var cells = tr.cells;
            var dropdown = $(cells).find(".t-dropdown input").data("tDropDownList");
             
              
            if (dropdown) {
--------- Even though "Id" is at correct index, I get valur of previous index" -----------------
                alert("Id = " + cells[indexOfIdColumn + 1].innerHTML);
                alert("SelectedMatchStatusId = " + dropdown.value());
  
                //                var o = {
                //                    'EntityId': cells[indexOfIdColumn].innerHTML,
                //                    'SelectedMatchStatusId': dropdown.value()
                //                };
                //                results.push(o);
            }
            else {
                throw "Operations Submit Error" + JSON.stringify(cells);
            }
        });
0
Accepted
Atanas Korchev
Telerik team
answered on 22 Apr 2011, 07:03 AM
Hi Tejas,

 You can use the following selector to get the master rows only:

 

$("#GridName tbody > tr.t-master-row, #GridName .t-grid-content tbody > tr.t-master-
row"
)

Perhaps the column index is off by one because of the new column which is used to hold the toggle arrow for the detail view. You may need to add 1 to that index if you are using it to get the cell which corresponds to certain column.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ashok
Top achievements
Rank 1
answered on 22 Apr 2011, 02:42 PM
Awesome !!!

Thanks for all help. You should think about producing some document or help around this.

Does Telerik has any 800 number for Support which we can reach in case we need some immediate assistance.
0
Atanas Korchev
Telerik team
answered on 22 Apr 2011, 02:57 PM
Hi Tejas,

 Telerik currently does not provide phone support.

 To get guaranteed response within 24 working hours we recommend using our support ticketing system. Have in mind though that only licensed developers are able to open support tickets. You can ask your license holder to add you as a licensed developer using the Telerik 

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Ashok
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Ashok
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or