-
不存在具有键“categoryid”的“IEnumerable<SelectListItem>”类型的 ViewData5
代码如下:
<span class="rowcontent">
<%:Html.DropDownListFor(model=>model.categoryid,(IEnumerable<SelectListItem>)ViewData["categories"])%>
<%:Html.ValidationMessageFor(model=>model.categoryid) %>
</span>
[HttpPost]
public ActionResult Create(FormCollection collection)
{
try
{
User user = CurrentUser();
Log log = new Log();
log.Title = collection["Title"];
log.Contents = collection["Contents"];
log.Publishat = System.DateTime.Now;
log.readtimes = 0;
log.sequence = mvcblog.Log.Count() + 1;
log.userid = user.UserID;
log.categoryid = System.Convert.ToInt32(collection["categoryid"]);
if (string.IsNullOrEmpty(collection["Title"]))
{
var categories = (from c in mvcblog.Category
where c.UserID == user.UserID
select c).ToList();
ViewData["categories"] = new SelectList(categories, "categoryid", "Name");
TempData["message"] = "标题不能为空";
return View(log);
}
else
{
mvcblog.Log.Attach(log);
mvcblog.Entry(log).State = EntityState.Added;
mvcblog.SaveChanges();
}
return RedirectToAction("Index/"+user.UserID.ToString());
}
catch
{
return View();
}
}2013年4月20日 15:06
目前还没有答案
相关推荐
很多常用的Linq写法,基于Vb.net,本人收获良多 ... Select <p><%= "Author: " & Key %><%= GetBooksTable(authorGroup) %></p> Dim result = <html><body><%= content %></body></html>
If Intcatid <> 0 Then rs.open "select category from category where categoryid="&Intcatid&" ",conn,1,1 strcategory = trim(rs("category")) rs.close strcat = strcat &"-><a href=chknews.asp?catid="&...
namespace LibraryManager { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private void MainForm_Load... IQueryable<Book> books = ((IQueryable<Book>)dgvBook...
var sdfsf123 = Sql.ExecuteList<Users>((a, b) => Sub.Top(8).Select(a.UserId, a.UserName).From(a) ); //目前支持返回 1实体类Sql.ExecuteEntity,2实体类列表,3表格,4字符串,5int var sdfsf123 = Sql....
hibernate 3中的缓存小结 2.2. 一级缓存的管理: ... <key column="categoryId" not-null="true"/> <one-to-many class="org.qiujy.domain.cachedemo.Product"/> </set> </class> </hibernate-mapping>
return Reader<Product>.Once.SetCommand(@"SELECT product.ProductId, product.Name, product.Price, product.Email, category.CategoryId, category.CategoryName FROM Products product, CateGories...
修复字典类型多线程问题:"已添加了具有相同键的项。 SpaceBuilder.Core/Framework/Common/User/UserID2UserNameDictionary.cs 9.修复ApplicationTag获取时报错 SpaceBuilder.Core/Service/SqlProvider/...
请求的url:/content/query/list 参数:categoryId 分类id 响应的数据:json数据 {total:查询结果总数量,rows[{id:1,title:aaa,subtitle:bb,...}]} EasyUIDataGridResult 描述商品数据List<TbContent>
1.A,运行效果图 1.B,源代码(主要代码摘要) /App_Code/DBConnection.cs /App_Code/CategoryInfo.cs 代码如下: using System.Collections... /// <summary> /// 1,子嵌套数据 /// </summary> public IList<ArticleInfo
temp += "<a href='news" + dr[0].ToString() + ".html'>" + dr[1].ToString() + "</a><br>"; } return temp; } public string LoadTemplate(string tempname) { return File.ReadAllText(MapPath(tempname)...
@ Html.DropDownListFor(model => item.Data.CategoryID,新的SelectList((IEnumerable)ViewData [“ categories”],“ CategoryID”,“ CategoryName”,item.Data.CategoryID),“-选择类别-”,新{@id =...
虚拟组件 虚拟dom的组件 安装 $ npm install virtual-component 用法 virtual-component使您可以在virtual-dom应用程序中编写react / deku样式的组件。... map ( story => < Story xss=removed> ) } < / di
https://opentdb.com/api.php?amount=10&category=<categoryId> 。 这将为您提供一个带有问题列表的 JSON 对象(需要进行一些数据操作),您将需要questions属性以及该数组中的question和correct_answer属性。 目标/...
本文介绍了Vue2.0 实现单选互斥的...<template> <dd @click="changeCategory(currCourseFirst.categoryId)" v-for="currCourseFirst in currCourse.currCourseFirst" :key="currCourseFirst.categoryId" :class=
吧ONGL标签放到html标签中,来操作html的标签就可以了 例子代码: html 代码如下: <div id=”categoryid” xss=removed><s value=”id”/></div> javascript 代码如下: [removed] var categoryid = document....
京东众筹爬虫 可以改变categoryId参数改变爬取数据分类 每次爬取需要移除文件夹中的Excel文件,或更改源代码中的Excel表中
[C#] DataSet ds = SqlHelper.ExecuteDataset( connectionString, CommandType.StoredProcedure, "getProductsByCategory", new SqlParameter("@CategoryID", categoryID)); 注意: Application Block for .NET...
"否 "商品封面 " "categoryid "int 外键 "否 "外键,商品分类id" " " " ",关联到分类表 " "content "text "否 "商品描述 " 分类表(category) "字段 "类型 "是否为空 "描述 " "categoryid "int "否 "主键 " "name ...
hot = df['price'][df['categoryId']=='⽂胸'][df['sellCount']>1500].count() # 热卖数 selling = df['price'][df['categoryId']=='⽂胸'][df['sellCount']>500][df['sellCount']<1500].count() # 常规数 normal = ...
NorthwindDataContext northwind = new NorthwindDataContext();... .Where("CategoryID = 3 AND UnitPrice > 3") .OrderBy("SupplierID"); GridView1.DataSource = query; GridView1.DataBind();