vb.net - loop and query is executing twice -


i adding blogs in website. work if click on title link of query string page title, desc, img display.but @ particular time loop executing 2 time. here code pls help.

  private sub sbloadblog()     try         dim unqstr string = request.querystring("id").tostring()         unqstr = unqstr.substring(0, unqstr.indexof("-"))         dim x string = "select distinct title url, img, blog_desc  blog_gallery_ays unqid  ='" + unqstr + "'"         dim dt new datatable         dt = dal.gettds(x).tables(0)         x = ""         x += "<p>"         each dr datarow in dt.rows             x += "<h2>'" + dr("url") + "'</h2>"             x += "<p>'" + dr("blog_desc") + "' </h2>"             x += "</br>"             x += "</br>"             x += "<img src='" + dr("img").tostring().replace("~/", "") + "'/>"          next         x += "</p>"         x += x.replace("'", """")         divblogdetail.innerhtml = x     catch ex exception      end try end sub  protected sub page_load(sender object, e eventargs) handles me.load     if not request.querystring("id") nothing         sbloadblog()     end if end sub 

use page.ispostback property verify if page being rendered first time or being loaded in response postback.

protected sub page_load(sender object, e eventargs) handles me.load     if not me.page.ispostback         if not request.querystring("id") nothing sbloadblog()     end if end sub  

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -