我在视图中有以下代码
<% foreach (var item in Model.stats)
{%>
<label style="style="float:left;"><%= item.Stat_Caption %></label>
<%=Html.TextBox(item.Stat_Caption,item.Stat_Value) %>
<%} %>
Run Code Online (Sandbox Code Playgroud)
我正在尝试将我的stats对象(只是一个列表集合)转换为文本框列表,以便用户可以更新它们.
我有工作,如果用户更新文本框,我如何将值应用回列表集合?
我试图获取基于aliasPath的文档这是整个aliasPath我试图得到/ PPIS/Vic-Residential/SERE26但我不想硬编码整个路径我只想使用最后一点这样的东西"?/ SERE26"我已尝试过所有组合,无法找到正确的通配符语句.
CMS.TreeEngine.TreeNode nodeCur = TreeHelper.GetDocument(CMSContext.CurrentSiteName,
"/PPIS/Vic-Residential/SERE26", "en-au", true, "CMS.MenuItem", false);
Run Code Online (Sandbox Code Playgroud) 我已经接管了一些奖品绘图代码.
我可以看到这个人正在使用一个随机数来命令它们,但这实际上是随机的,因为我看不到他做过的任何地方oRand.Next(); 默认的Random是否生成实际的随机数.
Random oRand = new Random();
var res = (from l in listNew.AsQueryable<Participant>() //entities.Participant
where l.Status != 0
select l).AsEnumerable().OrderBy(p=>oRand);
Run Code Online (Sandbox Code Playgroud) 这是我正在尝试做的事情:
(Dc.DET_Cases.Where(c => c.ProductID == pl.ProductID
&& oldTOR == false ? c.OldTOR == oldTOR :
&& (productLineName.ToInt() == 0 || productLineName.ToInt() == c.ProductLineID)
&& (productCategory.ToInt() == 0 || productCategory.ToInt() == c.ProductCategoryID)
&& (issueType.ToInt() == 0 || issueType.ToInt() == c.IssueTypeID)
&& (issue.ToInt() == 0 || issue.ToInt() == c.IssueID)
)
.FirstOrDefault() != null)
Run Code Online (Sandbox Code Playgroud)
这是我想要做的路线.
oldTOR == false ? c.OldTOR == oldTOR :
Run Code Online (Sandbox Code Playgroud)
在whereLINQ语句中.如果值为false,则比较该值.如果没有,那么忽略它.