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

[Solved] MVC grid is not loading detailview in windows

2 Answers 139 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Riyasat
Top achievements
Rank 1
Riyasat asked on 06 Aug 2012, 02:40 PM
Hi,

Here is the scenario, I have indexed page with telerik MVC grid which have one main then two details grids. On 2nd grid I have an event OnSelectRow where I am displaying popup window of telerik window component using ajaxRequest call. this Ajax is loading partial view. This partial view have another grid which have several detail views. Every thing works fine except in popup window i cannot see detail view even if I add only text.

JavaScript Ajax Call on 
function DetailViewForSegment(e) { /// called on row click of main page grid.
         var row = e.row;
        var grid = $(this).data("tGrid");
        var dataItem = grid.dataItem(row);
        var detailWindow = $("#DetailedViews").data("tWindow");
        detailWindow.title("Test Window");
        detailWindow.ajaxRequest('@Url.Action("ProcessSegment","Order")', { SegmentID: dataItem.SegmentID });
        detailWindow.title(dataItem.ProcessSegment);
        detailWindow.open();
}



Bellow is partial view code:
@model IEnumerable<table1>
            
@(Html.Telerik().Grid(Model)
    .Name("ProcessSegment_"+ViewBag.Segment)
    .Columns(column =>
                    {
                        column.Bound(o => o.ProductType);
                        column.Bound(o => o.ProductUnitId);
                        column.Bound(o => o.State);
 
                    })
        .DataBinding(dataBinding => dataBinding.Ajax()
                                .Select("GetSegment", "Order", new { SegmentID = ViewBag. 
Segment }))
 
            .DetailView(detailView => detailView.ClientTemplate(
                Html.Telerik().TabStrip().Name("tbstr").Items(
                    it =>
                    {
                        it.Add().Text("ok");
                        it.Add().Text("displayed");
                    })
                        .ToHtmlString()
                ))
 
 
        .Selectable()
         
        )

controller code

public ActionResult GetSegment (string SegmentID)
       {
           //DEMO DATA
           Random rnd = new Random();
           var tSegment = new List<Segments>
                                    {
                                        new Segments()
                                            {
                                                   SegmentID = "1",
                                                   ProductType = "BIW",
                                                   ProductUnitId = "01000000001",
                                                   State = "Finished",
                                                                                    
                                            },
                                            new Segments()
                                            {
                                                 
                                                   ProcessSegmentID = "2",
                                                   ProductType = "PNT",
                                                   ProductUnitId = "01000000001",
                                                   State = "In Progress",
                                                                                    
                                            },
                                            new Segments()
                                            {
                                                 
                                                   ProcessSegmentID = "2",
                                                   ProductType = "Roof",
                                                   ProductUnitId = "01000000002",
                                                   State = "In Progress",
                                                    
                                            }
                                    };
           ViewBag.SegmentID =SegmentID;
           return PartialView("GetSegment");
       }

Please help I am stuck in it from last 6 hours. :(

2 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 09 Aug 2012, 06:32 AM
Hello Riyasat,

Could you please change your code so it ensures that the name of the TabStrip is unique.
e.g.
Html.Telerik().TabStrip().Name("tbstr_<#= ProductUnitId #>")
Give a try and let me know if it helps or not.


Kind Regards,
Petur Subev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
0
Riyasat
Top achievements
Rank 1
answered on 09 Aug 2012, 06:45 AM
Hi Peture,

thanks for the reply, I had already solved the problem by making each an every gui with unique ending name. I used new Guid to get unique ID for each grid e.g.
Html.Telerik().Grid().Name("tbstr_<#= ProductUnitId #>"+new Guid())....
Html.Telerik().Tabstrip().Name("tbstr_<#= ProductUnitId #>"+new Guid())....

I am not sure if it is getting unique value for each itteration but this seems to work for now :).

if you have any other idea please do let me know.
I have also tried to call javascript fuction from <"# GetUniqueID() #"> but that also didn't helped I start getting errors JScript error. My JS function was
var id=1;
function GetUniqueID(){
id++;
return id;
}
more help will be appericiated

Tags
Window
Asked by
Riyasat
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Riyasat
Top achievements
Rank 1
Share this question
or