我有一個web應用程序,它會生成一些webgets並返回Gridview
中的結果。有時,應用程序可能需要製作400多個網頁,但只能用15-20條記錄填充網格。添加到GridView的方法
是否有辦法部分加載GridView
,以便每個記錄都附加到現有的GridView
?
添加代碼
List<Test> testList = new List<Test>();
foreach (Location str in list)
{
string url;
try
{
url = "http://www.test.com/" + str.Url;
XmlReader reader = XmlReader.Create(url);
Rss10FeedFormatter formatter = new Rss10FeedFormatter();
if (formatter.CanRead(reader))
{
formatter.ReadFrom(reader);
IEnumerable<SyndicationItem> items = formatter.Feed.Items;
int itemCt = 1;
foreach (SyndicationItem item in items)
{
Test test = new Test();
test.Name = item.Name;
test.City= item.City;
testList.Add(data);
//if I add this here, the RowDatabound does not fire, if I take out, it works fine but only after all requests are made
listGrid.DataSource = temp;
listGrid.DataBind();
}
}
else
throw new ApplicationException("Invalid RSS 1.0 feed at " + FeedUrl.Text.Trim());
}
分享你的代碼,請 –