/// <summary> /// 在RowDataBound時建立HyperLink控制項 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gv_Account_RowDataBound(object sender, GridViewRowEventArgs e) { try { //產生TableCell TableCell tc = new TableCell(); //若為DataRow則放入HyperLink if (e.Row.RowType == DataControlRowType.DataRow) { //修改 HyperLink HL_Edit = new HyperLink(); HL_Edit.Text = "修改"; HL_Edit.NavigateUrl = "~/logistics_account.aspx?act=edit&id=" + e.Row.Cells[0].Text; tc.Controls.Add(HL_Edit); //空白 lbl_space = new Label(); lbl_space.Text = " "; tc.Controls.Add(lbl_space); //列印條碼 HyperLink HL_PrintBarcode = new HyperLink(); HL_PrintBarcode.Text = "列印條碼"; HL_PrintBarcode.NavigateUrl = "~/logistics_account.aspx?act=barcode&id=" + e.Row.Cells[0].Text; tc.Controls.Add(HL_PrintBarcode); //空白 lbl_space = new Label(); lbl_space.Text = " "; tc.Controls.Add(lbl_space); //產生Link(淘寶交易號) LBtn_Temp = new LinkButton(); LBtn_Temp.Text = "刪除"; LBtn_Temp.OnClientClick = "return delete_account(this, '" + e.Row.Cells[0].Text + "');"; tc.Controls.Add(LBtn_Temp); } //若為Header則改標頭 if (e.Row.RowType == DataControlRowType.Header) { tc.Text = "動作"; } //將TableCell加入Gridview中 e.Row.Cells.Add(tc); //光棒效果 //判定row的型態是資料行 if (e.Row.RowType == DataControlRowType.DataRow) { GvLightBar.lightbar(e, 1); } } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
/// <summary> /// 加光棒效果 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gv_logistics_RowDataBound(object sender, GridViewRowEventArgs e) { try { //光棒效果 //判定row的型態是資料行 if (e.Row.RowType == DataControlRowType.DataRow) { GvLightBar.lightbar(e, 1); } } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { //若為DataRow則放入HyperLink if (e.Row.RowType == DataControlRowType.DataRow) { //箱號 var tempCell = GetCellByName(e.Row, "系列"); if (str_tempbox != tempCell.Text) { str_tempbox = tempCell.Text; tempColor = (tempColor == System.Drawing.Color.DarkGreen) ? System.Drawing.Color.DarkRed : System.Drawing.Color.DarkGreen; } tempCell.ForeColor = tempColor; } //光棒效果 GvLightBar.lightbar(e, 2); }
protected void gv_Report_RowDataBound(object sender, GridViewRowEventArgs e) { //判定row的型態是資料行 if (e.Row.RowType == DataControlRowType.DataRow) { if (DDL_SearchType.SelectedItem.Text == "展售未上架") { //優先上架打勾/變色 var temp = GetCellByName(e.Row, "系列編號"); if (sYeslist.Contains(temp.Text)) { temp.ForeColor = System.Drawing.Color.Red; CheckBox CBtemp = GetCellByName(e.Row, "選擇").FindControl("CB_Detail") as CheckBox; CBtemp.Checked = true; } } } //光棒效果 GvLightBar.lightbar(e, 1); }
/// <summary> /// gv_Detail_RowDataBound /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gv_Detail_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { CheckBox CBtemp = GetCellByName(e.Row, "選擇").FindControl("CB_Detail") as CheckBox; //展售在途有數不給選--------------- var 展售 = int.Parse(GetCellByName(e.Row, "展售").Text); var 在途 = int.Parse(GetCellByName(e.Row, "在途").Text); var 瑕疵 = int.Parse(GetCellByName(e.Row, "瑕疵").Text); if (DDL_SearchType.SelectedItem.Text == "庫存銷售") { if ((展售 > 0 || 在途 > 0) && !CB_強制勾選.Checked) { CBtemp.Enabled = false; } else { CBtemp.Enabled = true; } } else if (DDL_SearchType.SelectedItem.Text == "瑕疵" || DDL_SearchType.SelectedItem.Text == "問題件") { if (瑕疵 > 0 || CB_強制勾選.Checked) { CBtemp.Enabled = true; } else { CBtemp.Enabled = false; } } //--------------------------------- } //光棒效果 GvLightBar.lightbar(e, 3); }
/// <summary> /// 加光棒效果 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gv_logistics_RowDataBound(object sender, GridViewRowEventArgs e) { try { e.Row.Cells[0].Width = 200; if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[5].ForeColor = System.Drawing.Color.ForestGreen; } //光棒效果 //判定row的型態是資料行 if (e.Row.RowType == DataControlRowType.DataRow) { GvLightBar.lightbar(e, 1); } } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
/// <summary> /// gv_Detail_RowDataBound /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton CBtemp = GetCellByName(e.Row, "功能").FindControl("Print") as LinkButton; var 撿貨者 = GetCellByName(e.Row, "撿貨者").Text; var 訂單狀態 = GetCellByName(e.Row, "訂單狀態").Text; if (撿貨者 != "未確認" || 訂單狀態 == "取消") { CBtemp.Visible = false; } else { CBtemp.Visible = true; } //--------------------------------- } //光棒效果 GvLightBar.lightbar(e, 2); }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { GvLightBar.lightbar(e, 2); }
/// <summary> /// 加光棒效果 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gv_logistics_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (DDL_Type.SelectedValue == "1+") { e.Row.Cells[0].Width = 200; if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[5].ForeColor = System.Drawing.Color.ForestGreen; if (CB_Sort.Checked) { if (e.Row.Cells[2].Text.Trim() != preType) { for (int i = 0; i <= 5; i++) { e.Row.Cells[i].ForeColor = System.Drawing.Color.DarkRed; } } preType = e.Row.Cells[2].Text.Trim(); } else { if (e.Row.Cells[0].Text.Trim() != preType) { for (int i = 0; i <= 5; i++) { e.Row.Cells[i].ForeColor = System.Drawing.Color.DarkRed; } } preType = e.Row.Cells[0].Text.Trim(); } } } else { e.Row.Cells[0].Width = 200; if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[4].ForeColor = System.Drawing.Color.ForestGreen; if (e.Row.Cells[1].Text.Trim() != preType) { for (int i = 0; i <= 4; i++) { e.Row.Cells[i].ForeColor = System.Drawing.Color.Blue; } } preType = e.Row.Cells[1].Text.Trim(); } } //光棒效果 //判定row的型態是資料行 if (e.Row.RowType == DataControlRowType.DataRow) { GvLightBar.lightbar(e, 1); } } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
protected void gv_FList_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { //光棒效果 GvLightBar.lightbar(e, 1); }
protected void gv_Detail_RowDataBound(object sender, GridViewRowEventArgs e) { //光棒效果 GvLightBar.lightbar(e, 3); }