//Headerkryssruta för gridview grdResult: public void chkInkvalALLGrdRes_CheckedChanged(GridView grdResult_Inkop, object sender) { foreach (GridViewRow gvRow in grdResult_Inkop.Rows) { DerivCheckBox chksel = (DerivCheckBox)(gvRow.Cells[0].FindControl("chkInkval")); chksel.Checked = ((DerivCheckBox)sender).Checked; if (chksel.Checked == true) { Int32 val = 1; Int32 row = Int32.Parse(chksel.UnText); try { db.UpdateRecord_ChkBox(row, val); } finally { } } else if (chksel.Checked == false) { Int32 val = 0; Int32 row = Int32.Parse(chksel.UnText); try { db.UpdateRecord_ChkBox(row, val); } finally { } } } }
//Kryssruta för gridview gridArtister och grdResult: public void chkInkval_CheckedChanged(GridView gridArtister_Inkop, GridView grdResult_Inkop) { GridView crossgrid = new GridView(); if (grdResult_Inkop.Visible == true) { crossgrid = grdResult_Inkop; } else if (gridArtister_Inkop.Visible == true) { crossgrid = gridArtister_Inkop; } foreach (GridViewRow gvRow in crossgrid.Rows) { DerivCheckBox chksel = (DerivCheckBox)gvRow.FindControl("chkInkval"); if (chksel.Checked == true) { Int32 val = 1; Int32 row = Int32.Parse(chksel.UnText); //Sätter markeringsvärden för markerad rad: gvRow.BackColor = System.Drawing.ColorTranslator.FromHtml("#738A9C"); gvRow.ForeColor = System.Drawing.ColorTranslator.FromHtml("#F7F7F7"); gvRow.Font.Bold = true; try { db.UpdateRecord_ChkBox(row, val); } finally { } } else if (chksel.Checked == false) { Int32 val = 0; Int32 row = Int32.Parse(chksel.UnText); //Sätter tillbaka markeringsvärden för avmarkerad rad: gvRow.BackColor = System.Drawing.ColorTranslator.FromHtml("#F7F7F7"); gvRow.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4A3C8C"); gvRow.Font.Bold = false; try { db.UpdateRecord_ChkBox(row, val); } finally { } } } }
//Fungerar som en omstart och rensar alla inmatningsrutor odyl + display: public void button_Refresh_TB(HttpServerUtility server, string retursida) { SetChks_Inkop db = new SetChks_Inkop(); Int32 val = 0; try { db.UpdateRecord_ChkBox(val); server.Transfer(retursida); } finally { } }
//Headerkryssruta för gridview gridArtister: public void chkInkvalALLMain_CheckedChanged(GridView gridArtister_Inkop, object sender) { foreach (GridViewRow gvRow in gridArtister_Inkop.Rows) { DerivCheckBox chksel = (DerivCheckBox)(gvRow.Cells[0].FindControl("chkInkval")); chksel.Checked = ((DerivCheckBox)sender).Checked; if (chksel.Checked == true) { Int32 val = 1; try { db.UpdateRecord_ChkBox(val); } finally { } } else if (chksel.Checked == false) { Int32 val = 0; try { db.UpdateRecord_ChkBox(val); } finally { } } } }