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 removeurls 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:

  1. all urls tested stored in session["removeurl"]
  2. businessclass.searchimageurl() accepts removeurl object
  3. businessclass.searchimageurl() returns removeurl 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

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -