c# - Gridview binding with row header also column header from same table -


i want display data in gridview in matrix concept using asp.net,c# 4.0 & oracle 11g

able bind data dynamically in gridview when page load event

my requirement is

activity1    activity2    activity3 ...  activity 10       monday & date  tuesday & date  wednesday & date 

. . . .

sunday & date 

the code have tried

protected void getactivity() {     string query2 = "select activity1,activity2,activity3,activity4,activity5,activity6,totaldurtn daily_activities order activityno asc";     using (oracleconnection con = new oracleconnection(strconnection))     {         using (oraclecommand command2 = new oraclecommand(query2, con))         {             con.open();             datatable dtble2 = new datatable();             oracledataadapter oracleda2 = new oracledataadapter(command2);             oracleda2.fill(dtble2);             viewstate["dt"] = dtble2;             this.bindgrid();         }     } }  protected void bindgrid() {     displaygridview.datasource = viewstate["dt"] datatable;     displaygridview.databind(); }  protected void onrowediting(object sender, gridviewediteventargs e) {     displaygridview.editindex = e.neweditindex;     this.bindgrid(); }  protected void oncancel(object sender, eventargs e) {     displaygridview.editindex = -1;     this.bindgrid(); }  protected void onupdate(object sender, eventargs e) {     gridviewrow row = (sender linkbutton).namingcontainer gridviewrow;     string activity1 = (row.cells[0].controls[0] textbox).text;     string activity2 = (row.cells[1].controls[0] textbox).text;     string activity3 = (row.cells[2].controls[0] textbox).text;     string activity4 = (row.cells[3].controls[0] textbox).text;     string activity5 = (row.cells[4].controls[0] textbox).text;     string activity6 = (row.cells[5].controls[0] textbox).text;     string totaldurtn = (row.cells[6].controls[0] textbox).text;      datatable dt = viewstate["dt"] datatable;     dt.rows[row.rowindex]["activity1"] = activity1;     dt.rows[row.rowindex]["activity2"] = activity2;     dt.rows[row.rowindex]["activity3"] = activity3;     dt.rows[row.rowindex]["activity4"] = activity4;     dt.rows[row.rowindex]["activity5"] = activity5;     dt.rows[row.rowindex]["activity6"] = activity6;     dt.rows[row.rowindex]["totaldurtn"] = totaldurtn;     viewstate["dt"] = dt;     displaygridview.editindex = -1;     this.bindgrid(); }   protected void displaygridview_rowdatabound(object sender, gridviewroweventargs e) {     if (e.row.cells.count > 0)     {         if (e.row.rowtype == datacontrolrowtype.header)         {             e.row.cells[0].text = datetime.now.toshortdatestring();             //e.row.cells[0].text = datetime.now.toshortdatestring();         }     } } 

can gridview if how ?


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -