asp.net - display data dynamically in gridview -
i have list of image urls have check whether url responding or not. adding url not responding gridview 1 one . problem
when first not responding url displaying in gridview
, when subsequent invalid url added, replacing first. need display removeurl
s in gridview
here code:
list<removeurl> removeurl = new list<validateurlofhiipsdata.removeurl>(); datatable dtfpid = businessclass.gethotelfpid(); (int = 1; <= 2; i++) { if (session["removeurl"] != null) { removeurl = (list<removeurl>)session["removeurl"]; } removeurl = businessclass.searchimageurl(i)/*checking url valid or not; session["removeurl"] = removeurl; gvremovedurl.datasource = session["removeurl"]; gvremovedurl.databind(); }
each time iterate through for
loop, setting removeurl
list value stored in session["removeurl"]
. don't think after.
i have made assumptions:
- all urls tested stored in
session["removeurl"]
businessclass.searchimageurl()
acceptsremoveurl
objectbusinessclass.searchimageurl()
returnsremoveurl
object
if so, following code point in right direction. (untested)
datatable dtfpid = businessclass.gethotelfpid(); if (session["removeurl"] != null) { list<removeurl> allurls = (list<removeurl>)session["removeurl"]; // set list values stored in session - assume these ones want verify? list<removeurl> removeurls = new list<validateurlofhiipsdata.removeurl>(); // list of invalid urls (int = 0; < allurls.length; i++) { // iterate through urls // check if valid , add removeurls list removeurls.add(businessclass.searchimageurl(allurls[i])) } gvremovedurl.datasource = removeurls; gvremovedurl.databind(); }
Comments
Post a Comment