public class RegisterSubscription
{
public string ID { get; set; }
public string Description { get; set; }
public int SubscrSelected { get; set; }
public string Image { get; set; }
public string InfoUrl { get; set; }
}
private List<RegisterSubscription> activePlans = new List<RegisterSubscription>();
Run Code Online (Sandbox Code Playgroud)
在我的控制器中,我有ViewBag.ActivePlans = activePlans; 并且ViewBag填充了正确的数据.现在在我看来,我有:
@foreach (var item in ViewBag.ActivePlans)
{
<li class="popupmenu" id="service_@(item.ID)" >
<div>
@Html.Image(item.Image, new { style="border-style:none; text-align:left; vertical-align:middle; width:64px; height:64px" })
</div>
</li>
}
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:'System.Web.Mvc.HtmlHelper'没有名为'Image'的适用方法,但似乎有一个名称的扩展方法.无法动态分派扩展方法.考虑转换动态参数或调用扩展方法而不使用扩展方法语法.
任何帮助将不胜感激,谢谢你提前.
我已经安装了Scott的Kirkland DataAnnotationsExtensions.
在我的模型中,我有:
[Numeric]
public double expectedcost { get; set; }
Run Code Online (Sandbox Code Playgroud)
在我看来:
@Html.EditorFor(model => model.expectedcost)
Run Code Online (Sandbox Code Playgroud)
现在,当页面尝试渲染时,我收到以下错误:
不显眼的客户端验证规则中的验证类型名称必须是唯一的.以下验证类型不止一次出现:数字
任何想法为什么我收到错误?
asp.net-mvc unobtrusive-javascript data-annotations asp.net-mvc-3
我有两个图像clear.jpg和thumbclear.jpg,第二个是我用第一个创建的缩略图,代码如下: 我还没有做任何调整大小
Bitmap bitmap = new Bitmap(File.InputStream);
MemoryStream st = new MemoryStream();
try
{
bitmap.Save(st, ImageFormat.Png);
return st;
}
finally
{
bitmap.Dispose();
}
Run Code Online (Sandbox Code Playgroud)
所以然后我将这两个图像上传到blob并获取它们的URI并将它们复制/粘贴到浏览器中.第一个 http://127.0.0.1:10000/devstoreaccount1/media/e1a987d1-c731-4e26-9e6c-d7a63b62f661/clear.png 工作正常,
但第二个http://127.0.0.1:10000/devstoreaccount1/media/b7ba6428-9db4-4282-8991-7a8198e7126f/thumbclear.png 给出了以下错误:
无法显示图像"http://...thumbclear.png",因为它包含错误.
所以我认为它与位图有关.任何帮助将不胜感激.
**编辑 我用来保存blob的代码
public static CloudBlob SaveFileToBlob(MemoryStream stream, string blobContainerName, string filename, string extension, string contentType, int fileSize)
{
if (stream != null)
{
CloudBlobContainer _BlobContainer = SessionHelper.GetBlobContainer(blobContainerName);
var permissions = new BlobContainerPermissions();
permissions.PublicAccess = BlobContainerPublicAccessType.Container;
_BlobContainer.SetPermissions(permissions);
Guid blobid = Guid.NewGuid();
var blob = _BlobContainer.GetBlobReference(blobid.ToString() + "/" + filename); …
Run Code Online (Sandbox Code Playgroud)