void gridPanel1_RowDataBound(WSWD.WmallPos.POS.FX.Win.UserControls.GridRow row) { if (row.RowState == GridRowState.Added) { // init cells row.Cells[0].Controls.Add(new Label() { Text = "Title", AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleLeft, Dock = DockStyle.Fill }); row.Cells[1].Controls.Add(new Label() { Text = "Date", AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, Dock = DockStyle.Fill }); row.Cells[2].Controls.Add(new Label() { Text = new Random().Next(100).ToString(), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.BottomRight, Dock = DockStyle.Fill }); } }
/// <summary> /// 그리드 메인 데이터 바인딩 /// </summary> /// <param name="row"></param> void grd_RowDataBound(WSWD.WmallPos.POS.FX.Win.UserControls.GridRow row) { if (row.RowState == GridRowState.Added) { for (int i = 0; i < 5; i++) { row.Cells[i].Controls.Add(new Label() { Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[i].ToString(), AutoSize = false, TextAlign = i == 0 || i == 2 ? ContentAlignment.MiddleRight : ContentAlignment.MiddleLeft, Dock = DockStyle.Fill }); } } else { DataRow[] drFilter = dtAddTicket.Select(string.Format("ColNum = '{0}'", row.Cells[1].Controls[0].Text.ToString())); if (drFilter != null && drFilter.Length > 0) { row.Cells[0].Controls[0].Text = drFilter[0]["ColNo"].ToString(); } } }
/// <summary> /// 그리드 Row Index Change Event /// </summary> /// <param name="beforeRow"></param> /// <param name="afterRow"></param> void grd_RowIndexChanged(WSWD.WmallPos.POS.FX.Win.UserControls.GridRow beforeRow, WSWD.WmallPos.POS.FX.Win.UserControls.GridRow afterRow) { _drRow = null; if (grd.CurrentRowIndex >= 0 && grd.RowCount > 0) { _drRow = (System.Data.DataRow)(grd.GetRow(grd.CurrentRowIndex).ItemData); } //컨트롤 초기화 InitControl(); }
/// <summary> /// 그리드 메인 데이터 바인딩 /// </summary> /// <param name="row"></param> void grd_RowDataBound(WSWD.WmallPos.POS.FX.Win.UserControls.GridRow row) { if (row.RowState == GridRowState.Added) { for (int i = 0; i < 4; i++) { lbl = new Label(); lbl.Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[i].ToString(); lbl.AutoSize = false; lbl.TextAlign = i == 0 || i == 1 ? System.Drawing.ContentAlignment.MiddleCenter : System.Drawing.ContentAlignment.MiddleLeft; lbl.Dock = DockStyle.Fill; lbl.DoubleClick += new EventHandler(lbl_DoubleClick); row.Cells[i].Controls.Add(lbl); } } }
/// <summary> /// 그리드 데이터 바인딩 /// </summary> /// <param name="row"></param> void grd_RowDataBound(WSWD.WmallPos.POS.FX.Win.UserControls.GridRow row) { if (row.RowState == GridRowState.Added) { // init cells row.Cells[0].Controls.Add(new Label() { Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[0].ToString(), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, Dock = DockStyle.Fill }); row.Cells[1].Controls.Add(new Label() { Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[1].ToString(), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleLeft, Dock = DockStyle.Fill }); } }
/// <summary> /// 그리드 데이터 바인딩 /// </summary> /// <param name="row"></param> void grd_RowDataBound(WSWD.WmallPos.POS.FX.Win.UserControls.GridRow row) { int iRow = 0; if (row.RowState == GridRowState.Added) { //쿠폰코드 row.Cells[iRow].Controls.Add(new Label() { Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[iRow].ToString(), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, Dock = DockStyle.Fill }); iRow++; //쿠폰종류 row.Cells[iRow].Controls.Add(new Label() { Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[iRow].ToString(), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleLeft, Dock = DockStyle.Fill }); iRow++; //쿠폰적용제한 row.Cells[iRow].Controls.Add(new Label() { Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[iRow].ToString(), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, Dock = DockStyle.Fill }); iRow++; //쿠폰적용시작일 row.Cells[iRow].Controls.Add(new Label() { Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[iRow].ToString(), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, Dock = DockStyle.Fill }); iRow++; //쿠폰적용종료일 row.Cells[iRow].Controls.Add(new Label() { Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[iRow].ToString(), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, Dock = DockStyle.Fill }); iRow++; //쿠폰적용판매금액 row.Cells[iRow].Controls.Add(new Label() { Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[iRow].ToString(), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleRight, Dock = DockStyle.Fill }); iRow++; //할인구분 row.Cells[iRow].Controls.Add(new Label() { Text = ((System.Data.DataRow)(row.ItemData)).ItemArray[iRow].ToString(), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, Dock = DockStyle.Fill }); iRow++; string val = ((System.Data.DataRow)(row.ItemData)).ItemArray[iRow].ToString(); int amt = int.Parse(val.Substring(0, val.Length - 1)); string gb = ((System.Data.DataRow)(row.ItemData)).ItemArray[6].ToString(); //할인금액 row.Cells[iRow].Controls.Add(new Label() { Text = string.Format("{0:#,##0}{1}", amt, gb.Equals("1") ? "원" : "%"), AutoSize = false, TextAlign = System.Drawing.ContentAlignment.MiddleRight, Dock = DockStyle.Fill }); } }
void gridPanel1_RowIndexChanged(WSWD.WmallPos.POS.FX.Win.UserControls.GridRow beforeRow, WSWD.WmallPos.POS.FX.Win.UserControls.GridRow afterRow) { }