viewstate - Remove elements of List<int> use View State in asp.net -


i meeting problem view state. here code:

public list<int> listid {           {          return (list<int>)viewstate["listid"];      }      set      {          viewstate["listid"] = value;      }  } protected void btadd_click(object sender, eventargs e) {     viewstate.remove("listid");     foreach (treenode tn in tvfaq.checkednodes)     {         if (tn.checked)         {             id = tn.valuepath;             listid = passid.listid(id);         }      }      if(listid!=null)      {         listbyid();      } } 

in function listbyid() use "listid.count" elements of listid can not remove, when in page, element of listid wil auto increase until close page. please me remove elements of listid after click on button "add". thank much.

it should removed.

you can try this

viewstate["listid"] = null; 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -