【问题标题】:HTML is not getting rendered on WEBGRIDHTML 未在 WEBGRID 上呈现
【发布时间】:2013-05-25 07:44:24
【问题描述】:

Webgrid 不呈现 html,它来自 sql 对我来说。请在下面查看我的问题。请帮帮我,因为我被困在中间了。

SELECT DISTINCT r.ReportName AS [Report Name] ,r.ReportDesc AS [Report Desc]
,<a href="user/details/12" class="aPopup">View Extra details</a> AS [Report Extra   
Details] FROM r.Reports and basically i am displaying this data directly on Webgrid.

The webgrid is dynamic and i am not specifying any columns name on it.

When i render my webgrid it shows the data as <a href="user/details/12"     
class="aPopup">View Extra details</a> in the column, instead i want to display it 
like "View Extra Details" with the hyperlink / link. Please help me how can i do this ?

Once it display the column with "View Extra details" i can have a jquery to open the     
popup, but the deal here how can i avoid displaying <a href="user/details/12"    
class="aPopup">View Extra details</a> in the column.

Looks like its not rendering the html on Webgrid, i tried Html.Raw but it was of no use.

Please let me know how to solve this issue.

【问题讨论】:

    标签: asp.net-mvc asp.net-mvc-4 webgrid


    【解决方案1】:

    我修好了

    foreach (KeyValuePair<string, object> keyValuePair in eachFlowRow)
            {
                if (keyValuePair.Key.Contains("Report Extra Details"))
                {
                    var newEntry = new KeyValuePair<string, object>(keyValuePair.Key, @Html.Raw("<a href='Home/Index' class='aPopup'>Vijay</a>"));
                    row.Add(newEntry);
                }
                else
                {
                    row.Add(keyValuePair);
                }
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-06
      • 1970-01-01
      • 2014-03-14
      • 2017-09-04
      相关资源
      最近更新 更多