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

[Solved] Grid Columns ClientTemplate problem

1 Answer 68 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.
Richard
Top achievements
Rank 1
Richard asked on 23 Jul 2010, 10:33 AM
Hi!

I have a problem, question about  MVC Grid.
Here is my code:

  .Columns(c =>
            {
c.Bound(o => o.Computer).ClientTemplate("<a onclick=openDefault('<#=Computer#>'); return false;'   href=#" + "\">" + "<#=Computer#>" + "</a>").Encoded(false).Title("Computer").HtmlAttributes(new { @class = "ihover ReceivedMemos" });
  }

And the openDefault script:

<script type="text/javascript">
      
      function openDefault(miez) {
          var manager1 = $find("<%= RadWindowManager2.ClientID %>");
          var str3 = "/ComputerNameDefaults/ComputerNameDefaults/" + miez;
          manager1.open(str3, "RadWindow2");
      
  </script>

and this works perfectly, if the item of columns is one string.
For example, it's works, if Computer's item is "Computer1", but it's don't works, if item is "Computer 2".
I tested this on an other way, apart from a grid:

 <a href="#"  onclick="openDefault('Computer 2'); return false;"> JavaScript </a>

And this works perfectly, so i think, the script is good.
I believe it so the problem is '<#=Computer#>' argument passing, but i don't now how can i fix it.

Thank you for the help ahead


1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 23 Jul 2010, 01:32 PM
I got help, the problem was in the syntax
The correct form :

 .Columns(c =>
            {
c.Bound(o => o.Computer).ClientTemplate("<a onclick=\"openDefault('<#=Computer#>'); return false;\"'   href=#" + "\">" + "<#=Computer#>" + "</a>").Encoded(false).Title("Computer").HtmlAttributes(new { @class = "ihover ReceivedMemos" });
  }

Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or