Can DataList inside GridView be binded using TPL to improve performance in ASP.Net? -


i have asp.net gridview , inside have datalist. binding datalist code behind (i.e. aspx.cs).

the binding done when receive rowdatabound event gridview.

when rowdatabound executed fetch datalist gridview, assign datasource , bind it.

so thread safe , cause exception in customer's site?

aspx design:

      <asp:gridview id="gvexpenseroll" runat="server" autogeneratecolumns="false" datasourceid="gvlevel1source"             showfooter="false" cellpadding="1" forecolor="#333333" onrowdatabound="grdview_rowdatabound">             <rowstyle backcolor="#eff3fb" />             <editrowstyle backcolor="#2461bf" />             <selectedrowstyle backcolor="#d1ddf1" font-bold="true" forecolor="#333333" />             <pagerstyle backcolor="#2461bf" forecolor="white" horizontalalign="center" />             <headerstyle backcolor="#507cd1" font-bold="true" forecolor="white" />             <alternatingrowstyle backcolor="white" />             <footerstyle backcolor="#507cd1" font-bold="true" forecolor="white" />             <columns>                 <asp:templatefield headertext="day">                     <itemtemplate>                         <asp:label id="lblperiodname" runat="server" text='<%# bind("periodname") %>' width="90px"></asp:label>                         <asp:label id="lblsession" runat="server" text='<%# bind("sessionid") %>' visible="false"></asp:label>                         <asp:label id="lblrownumber" runat="server" text='<%# bind("rownumber") %>' visible="false"></asp:label>                     </itemtemplate>                 </asp:templatefield>                 <asp:templatefield>                     <headerstyle horizontalalign="left" />                      <itemtemplate>                         <asp:datalist id="dlitem" width="100%" cellpadding="1"                              repeatdirection="horizontal" runat="server" >                             <itemstyle horizontalalign="right" width="90px" borderwidth="1px" borderstyle="solid"                                 bordercolor="lightgray" />                              <itemtemplate>                                 <asp:label id="rownumber" runat="server" text='<%# eval("rownumber") %>' visible="false" />                                 <asp:label id="colnumber" runat="server" text='<%#eval("colnumber") %>' visible="false" />                                 <asp:label id="cellno" runat="server" text='<%#eval("cellno") %>' visible="false" />                                 <asp:label id="isbudget" runat="server" text='<%#eval("isbudget") %>' visible="false" />                                     <asp:linkbutton id="totalamount" onclick="view_details" runat="server" width="85px"                                      font-bold="true" text='<%# bind("totalamount","{0:n2}") %>' />&nbsp;                              </itemtemplate>                         </asp:datalist>                     </itemtemplate>                 </asp:templatefield>                 <asp:templatefield headertext="day">                     <itemtemplate>                         <asp:label id="lblperiodname1" runat="server" text='<%# bind("periodname") %>' width="90px"></asp:label>                     </itemtemplate>                     <itemstyle horizontalalign="right" />                 </asp:templatefield>             </columns>         </asp:gridview> 

aspx.cs:

protected void grdview_rowdatabound(object sender, gridviewroweventargs e) {       if (e.row.rowtype == datacontrolrowtype.datarow)      {         tasklist.add(task.factory.startnew(() => updategridrow(dl, rownum)));         task.waitall(tasklist.toarray());         tasklist.clear();      }  }   private void updategridrow(datalist dl, int rownum) {     datalist dl = (datalist)e.row.findcontrol("dlitem");  string compstr = "select sum(netamount) totalamount, rownumber, colnumber, cellno, isbudget omtexpenserolltemp sessionid='" + session["session_number"].tostring() + "' , rownumber = '" + rownum + "' , (rownumber not in (930,920,910,940) or (rownumber in (930,920,910,940) , isbudget<>'tc')) group rownumber, colnumber, cellno, isbudget order rownumber, colnumber, cellno";    dl.datasource = oraclehelper.executedataset(oracleconstr.constr, commandtype.text, compstr);    dl.databind();              foreach (datalistitem item in dl.items)     {         dlitem_itemdatabound(item);//just proceess each indiviual cell cell value set empty if value 0     }  } 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -