Data table in C#.net -


i have problem related datatable in .net. trying fill datatable on page_load .that part ok no issue datatable correctly filled data. noticed when clicked button on page... again try fill datatable time-consuming task... want datatable should fill once ,when , when site open in browser .. not @ every click ... because have large amount of data in table takes time load in datatable.. plz me out ... here code:

protectd void page_load(object sender, eventargs e) {         cnn.connectionstring= configurationmanager.connectionstrings["con"].connectionstring;        //  if (this.ispostback == true)         {             dr1 = tableutop();              dtwordslist.load(dr1);        } }  oledbdatareader tableutopunj(string arrword)     {         if (cnn.state == connectionstate.open)         {             cnn.close();         }         cnn.open();         oledbcommand cmd = new oledbcommand();         cmd.commandtext = "select u, p utop";         cmd.connection = cnn;         oledbdatareader dr = cmd.executereader();         return dr;     } 

you need check if page posting or not, this:

protected void page_load(object sender, eventargs e) {     cnn.connectionstring= configurationmanager.connectionstrings["con"].connectionstring;      if(!ispostback)     {         // happen when page first loaded, first time not considered post back, others         dr1 = tableutop();          dtwordslist.load(dr1);     } } 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -