我从数据库中选择了一行. 数据看起来像这样
I selected a row from DB. the data look like this
------------------- productid | Qty ------------------- 123 | 12我把它放在ViewData中.
I put this in ViewData.
ViewData["viewtest"] = selected data from above. (productid:123, qty:12)在视图上,我只想从视图数据中获取qty 值. 我应该使用哪种语法? 我一直在考虑来自asp的数据表或数据集.. 所以我尝试了ViewData["viewtest"][0]["qty"]...,等等都没用.. 我必须同时使用两个值(productid和qty),并从视图中拆分该值.. 有人可以帮忙吗?
on the View, I like to get only the qty value from the viewdata. what kind of syntax should I use for that? I keep thinking about datatable or dataset from asp.. So I tried ViewData["viewtest"][0]["qty"]... and so on which never works.. I have to bring the two values (productid and qty) at the same time and split the value from the view.. can anybody help??? thank you in advance.
推荐答案为什么不尝试-- Why don''t you try as - ViewData["ProductId"] = //select data for product id ViewData["Quantity"] = //select data for quantity
HTH 拉杰夫 如果有帮助,请投票并标记答案为可接受.
HTH Rajeev Please vote and mark the answer as accepted if this helps you.
更多推荐
如何从视图数据中获取特定的列值?
发布评论