C# 在控制器中创建的视图中未显示Html
在控制器中创建方法时,我希望在视图中显示HTML输出。虽然我将函数结果视为预期的html,但它不会显示在页面中 我已经尝试了HtmlHelper Html.RawC# 在控制器中创建的视图中未显示Html,c#,asp.net-mvc,C#,Asp.net Mvc,在控制器中创建方法时,我希望在视图中显示HTML输出。虽然我将函数结果视为预期的html,但它不会显示在页面中 我已经尝试了HtmlHelper Html.Raw <table class="table table-bordered table-framed" id="seconDTable" style="display:block;height:100%;"> <tbody>
<table class="table table-bordered table-framed" id="seconDTable" style="display:block;height:100%;">
<tbody>
@if (caseFile.Length > 0 && RenamedCaseFileName.Length > 0)
{
<tr>
<td style="width: 100%;">
<input type="checkbox" id="CheckBox" title="Select All Bookmarks" onchange="changeCheckBox();" class="styled" />
<span>Select All</span>
</td>
</tr>
if (oGdPicturePDFstatus == GdPicture14.GdPictureStatus.OK)
{
int rootID = oGdPicturePDF.GetBookMarkRootID();
oGdPicturePDFstatus = oGdPicturePDF.GetStat();
if (oGdPicturePDFstatus == GdPicture14.GdPictureStatus.OK)
{
IHtmlString str = new HtmlString(GetPDFBookmarks.ParseBookmarksOutlines(oGdPicturePDF, rootID, 0));
Html.Raw(str);
}
else
{
if (oGdPicturePDFstatus == GdPicture14.GdPictureStatus.PropertyNotFound)
{
<tr>
<td style="width: 100%;">
This PDF document doesn't contain any bookmarks.
</td>
</tr>
}
}
}
oGdPicturePDF.Dispose();
}
</tbody>
</table>
@if(caseFile.Length>0&&RenamedCaseFileName.Length>0)
{
全选
如果(oGdPicturePDFstatus==GdPicture14.GdPictureStatus.OK)
{
int rootID=oGdPicturePDF.GetBookMarkRootID();
oGdPicturePDFstatus=oGdPicturePDF.GetStat();
如果(oGdPicturePDFstatus==GdPicture14.GdPictureStatus.OK)
{
IHtmlString str=新的HtmlString(GetPDFBookmarks.ParseBookmarksOutlines(oGdPicturePDF,rootID,0));
Html.Raw(str);
}
其他的
{
if(oGdPicturePDFstatus==GdPicture14.GdPictureStatus.PropertyNotFound)
{
此PDF文档不包含任何书签。
}
}
}
oGdPicturePDF.Dispose();
}
功能:
public string ParseBookmarksOutlines(GdPicturePDF oGdPicturePDF, int bookmarkID, int level)
{
string title = "";
GdPictureStatus status = GdPictureStatus.OK;
string cssType = string.Empty;
string TableRows = string.Empty;
while (true)
{
title = oGdPicturePDF.GetBookMarkTitle(bookmarkID);
status = oGdPicturePDF.GetStat();
if (level == 0)
{
cssType = "ParentsourcefileCheckBox";
}
else
{
cssType = "ChildsourcefileCheckBox";
}
if (status == GdPictureStatus.OK)
{
TableRows = TableRows + "<tr><td style=\"width: 100 %; \">";
TableRows = TableRows + "<input name=\"sourcefileCheckBox\" type=\"checkbox\" class=\"" + cssType + "\" id=\"checkBox\" value=\"" + bookmarkID + "\" />";
TableRows = TableRows + "<span>" + title + "</span>";
TableRows = TableRows + "</td></tr>";
}
else
{
TableRows = TableRows + "<tr><td>";
TableRows = TableRows + "Title: this error occurs - " + status.ToString() + " Level: " + level.ToString() + "\n";
TableRows = TableRows + "</td></tr>";
//message = message + "Title: this error occurs - " + status.ToString() + " Level: " + level.ToString() + "\n";
}
if (bookmarkID == 0)
{
break;
}
}
return TableRows;
}
public string ParseBookmarksOutlines(GdPicturePDF oGdPicturePDF,int bookmarkID,int level)
{
字符串标题=”;
GdPictureStatus status=GdPictureStatus.OK;
string cssType=string.Empty;
string TableRows=string.Empty;
while(true)
{
title=oGdPicturePDF.GetBookMarkTitle(bookmarkID);
status=oGdPicturePDF.GetStat();
如果(级别==0)
{
cssType=“ParentsourcefileCheckBox”;
}
其他的
{
cssType=“ChildsourcefileCheckBox”;
}
如果(状态==GdPictureStatus.OK)
{
TableRows=TableRows+“”;
TableRows=TableRows+“”;
TableRows=TableRows+“”+标题+“”;
TableRows=TableRows+“”;
}
其他的
{
TableRows=TableRows+“”;
TableRows=TableRows+“标题:发生此错误-“+status.ToString()+”级别:“+Level.ToString()+”\n”;
TableRows=TableRows+“”;
//message=message+“Title:发生此错误-“+status.ToString()+”级别:“+Level.ToString()+”\n”;
}
if(bookmark id==0)
{
打破
}
}
返回表行;
}
我希望复选框显示在最终呈现的页面上,而不是全部显示
答案如下:
@Html.Raw(HttpUtility.HtmlDecode(GetPDFBookmarks.ParseBookmarksOutlines(oGdPicturePDF, rootID, 0)));
它位于邮政局: