0

I have the code below and I want to display the data in the table.

<div class="widget wblue no-margin-top">
  <div class="widget-head">
    <div class="pull-left">Country Languages</div>
    <div class="pull-right"><a href="#addLanguageModal" class="btn btn-navbar btn-gray" data-toggle="modal" role="button">Add New Language</a></div>
  </div>
  <div class="widget-content">
    @using (Html.BeginForm("Language", "Country", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
      @Html.HiddenFor(m => m.CountryId)
      @Html.Grid(Model.Languages).Columns(column =>
      {
        column.For(m => m.LanguageName).Named("Languages");
        column.For(m => String.Format("<a class='btn btn-primary' href='/Country/LanguageEdit/{0}'>Edit</a> <a href='#deleteConfirmModal' role='button' data-toggle='modal' class='btn btn-danger deleteBtn'><input type='hidden' id='CountryId' value='{0}'/>Remove</a>", m.CountryId)).Named("Actions").Encode(false);
      }).Attributes(@class => "table")
   }
  </div>
</div>

Unfortunately for this CountryId there is no language in the database. I saw it displayed the sentence

There is no data available.

I don't have this sentence There is no data available. in my code. My question is where is it from? How it was generated? From Bootstrap or Razor engine?

Peter B
  • 22,460
  • 5
  • 32
  • 69
Bigeyes
  • 1,508
  • 2
  • 23
  • 42

1 Answers1

2

The message is from your @Html.Grid. Like other helpers, this HTML helper will render an html grid component on the page which may or may not use javascript files along with it.

You can actually customize the message for empty data by doing the following: Overriding the default 'No Data' Message in MVCContrib Grid

GregH
  • 5,125
  • 8
  • 55
  • 109
  • It is helpful. The link use `<%` So for MVC 6 or latter I guess we need use `@` then? – Bigeyes Jun 29 '17 at 12:57
  • @Bigeyes in that link there is a piece of code which uses ASPX View Engine. The syntax which starts with @ is a Razor engine - a modern way to render dynamic views on the server side. Basically the API of all HtmlHelpers is the same. – Pavlo Hryza Feb 27 '18 at 10:05