hmgy - 2019/12/15 0:26:18
做了个下载专区,怎么在下载列表里读取编辑器里面附件的大小?

hmgy - 2019/12/16 15:58:04
xiyou - 2019/12/16 16:14:07
hmgy - 2019/12/16 21:38:25
回复 3楼xiyou的帖子读取大小 提示 NewsliList.cshtml(73): error CS0136: 不能在此范围内声明名为“item”的局部变量,因为这样会使“item”具有不同的含义,而它已在“父级或当前”范围中表示其他内容了!
- @{
- string templateDirectory = ViewBag.TemplateDirectory;
- int columnId = Html.CurrentColumnId();//当前栏目id
- PageInfo pageInfo = new PageInfo()
- {
- PageSize = 10,//每页显示12条数据
- CurrentPage = (int)ViewBag.CurrentPage //当前页码,系统预设
- };
- var dataList = Html.InfoDataList(new { ColumnId = columnId }, null, null, pageInfo);
- var columnContentData = Html.ColumnContentData();
- string zdytitle = columnContentData.Zlmlmmc;
- }
- @Html.Partial("xBannerPartial")
- <div class="container">
- @Html.Partial("BreadcrumbPartial")
- </div>
- <div class="container">
- <div class="row margin-top-20">
- <div class="web_navs1 margin-top-10">
- @Html.Partial("subNavPartial")
- </div>
- <div class="margin-top-10">
- <div class="zlm_news_mx web_wzwc_com">
- @foreach (var item in dataList)
- {
- string title = item.Title;
- if (title.Length > 30)
- {
- title = title.Substring(0, 30) + "...";
- }
- string introduction = item.Introduction;
- if (introduction.Length > 260)
- {
- introduction = introduction.Substring(0, 260) + "...";
- }
- string date = item.Thedate.ToString("MM/dd");
- string dates = item.Thedate.ToString("yyyy");
- string url = Html.InfoDataUrl((int)item.ColumnId, (int)item.Id);
- string thumbnail = item.Thumbnail;
- {
- <div class="news-item clearfix">
- <a href="@url" target="_self" class="clearfix">
- <div class="news-item-box">
- <div class="news-con-box">
- <div class="news-time">
- <time>@item.Thedate.ToString("yy-MM-dd")</time>
- <div class="news-icon">
- <span></span>
- </div>
- </div>
- <div class="news-con">
- <p class="news-title">
- @title
- </p>
- <p class="news-desc layout-107-news-desc" style="height: 120px; word-break: break-all; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 2; display: -webkit-box; -moz-box-orient: vertical;">@introduction</p>
-
- </div>
- </div>
- <div class="news-img">
- <img src="@thumbnail" class="t-img">
- <div class="dummy"></div>
- </div>
- </div>
- </a>
- <div>
- <!--读取文件大小-->
- <ul>
- @foreach (var item in Html.AttachmentDataList(new { ParentId=1, ParentTable = "news", ParentField = "content" }))
- {
- <li>
- <img src="@item.Path" alt="获取文件路径" />
- <img src="@item.Thumbnail" alt="图片缩列图路径,附件组此字段为空" />
- <span>文件大小:@item.Size kb</span>
- </li>
- }
- </ul>
- <!--读取文件-->
- </div>
- </div>
-
- }
- }
-
- </div>
-
- @Html.Partial("PagebreakPartial", pageInfo)
- </div>
- </div>
- </div>
复制代码