我使自己的消耗飼料小用戶控件的代碼,所述用戶控制裝置看起來像這樣Html.RenderPartial及具有相同ID錯誤
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SyndicationFeed >" %>
<%foreach (var rss in ViewData.Model.Items)
{
Response.Write("<div id={0}><a href={1} target=\"_blank\" /> <strong>{2}</strong></div>",
rss.Links[0].Uri.OriginalString, rss.Title.Text, rss.Title.Text);
Response.Write("<div>" + rss.Summary.Text.Truncate(100) + "</div>")
}%>
的RssController的代碼看起來像這樣多個控件
public virtual ActionResult Index()
{
string feedUrl = @"http://wdfw.wa.gov/news/newsrss.php";
using (XmlReader reader = XmlReader.Create(feedUrl))
{
SyndicationFeed rss = SyndicationFeed.Load(reader);
return View(rss);
}
}
我叫它的Site.Master像這樣
<%Html.RenderPartial("Index", Model);%>
我也試過
<%Html.RenderPartial("Index", ViewData.Model);%>
所有導致這個這個錯誤:
Multiple controls with the same ID 'ctl00' were found. Trace requires that controls have unique IDs.
有人可以幫我找出我要去哪裏錯了,請:)
禁用跟蹤。 – SLaks 2011-04-17 17:28:54