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

Unable to open a popup window

2 Answers 111 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.
scorp
Top achievements
Rank 1
scorp asked on 19 May 2011, 09:13 PM
I have a grid on one of my partial views with a template column with anchor text:I want to open up a popup window when the user clicks on the row passing in a parameter.

   columns.Template(@<text> 
                                            <a 
                                            href="javascript:ViewCourse('@item.CourseID')"
                                            onclick="javascrpt:ViewCourse('@item.CourseID')" >@item.CourseName</a>
                                            </text>)
                                            .Width(400)
                                            .Title("Course name");

When I click on the hyperlink on the grid nothing happens. I have the below javascript in the main view.

  <script type="text/javascript">
        function ViewCourse(CourseID) 
        {
            var url = '@Url.Action("ViewCourse", "CourseCatalog")';
            //alert(url);
            $.post(url, CourseID,
                function (data) {
                var window = $('#Window').data('tWindow');
                window.content(data);
                window.center().open();
            });

           }
        
    </script>


where Window is declared in the main view:

                     @(Html.Telerik().Window()
                              .Name("Window")
                              .Title("Course Description")
                              .Buttons(b => b.Maximize().Close())
                              .Visible(false)
                              .Modal(true)
                              .Width(500)
                              .Height(500)
                      )

2 Answers, 1 is accepted

Sort by
0
KooterB
Top achievements
Rank 1
answered on 09 Jun 2011, 10:41 PM
I am having the same Problem. I hope someone replies!!
0
Atanas Korchev
Telerik team
answered on 10 Jun 2011, 08:17 AM
Hi,

 Is the ViewCourse JavaScript function executed at all? What happens if you try debugging the code? Href only would suffice:

<a href="javascript: ViewCourse('@item.CourseID')" >@item.CourseName</a>

This is also an option (the href of a link must be set in order for it to be clickable)
<a href="#" onclick="ViewCourse('@item.CourseID')" >@item.CourseName</a>

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
scorp
Top achievements
Rank 1
Answers by
KooterB
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or