gridview單元格編輯新增資料

2022-04-19 14:36:02 字數 3273 閱讀 7323

行號

private

void gridview1_customdrawrowindicator(object

sender, devexpress.xtragrid.views.grid.rowindicatorcustomdraweventargs e)

else

if (e.rowhandle < 0 && e.rowhandle > -1000

) }}

宣告資料來源

private bindinglistdatasource;//

發票資料來源

//初始化資料來源

private

void frmaddindent_load(object

sender, eventargs e)

);datasource = new bindinglist();

dvginfo.datasource =datasource;

}

新增新行事件

private

void gridview1_initnewrow(object

sender, devexpress.xtragrid.views.grid.initnewroweventargs e)

單元格值,驗證,離開事件

private

void gridview1_cellvaluechanged(object

sender, devexpress.xtragrid.views.base.cellvaluechangedeventargs e)

decimal d = 0

;

if (gridview1.getfocusedrowcellvalue("

price

") != null

)

decimal dec = i *d;

//設定結果值

gridview1.setrowcellvalue(gridview1.focusedrowhandle, gridview1.columns["

amount

"], dec);

gridview1.columns["numberofpieces"], e.rowhandle + 1);

}

if (e.column.fieldname.equals("

amount"))

}

單元格控制項賦值

#region 發票明細資料

//原產地 gltxtcountryorigin.datasource = cname;//

原產地二字碼

this.gltxtcountryorigin.nulltext = ""

;

this.gltxtcountryorigin.displaymember = "

col001";

this.gltxtcountryorigin.valuemember = "

col001";

this.gltxtcountryorigin.allownullinput =devexpress.utils.defaultboolean.true;

this

.gltxtcountryorigin.view.bestfitcolumns();

this.gltxtcountryorigin.showfooter = false

;

this.gltxtcountryorigin.view.optionsview.showautofilterrow = true; //

顯示不顯示grid上第乙個空行,也是用於檢索的應用

= false;

this.gltxtcountryorigin.immediatepopup = true;///

/在輸入框按任一可見字元鍵時立即彈出下拉窗體

this.gltxtcountryorigin.popupfiltermode = devexpress.xtraeditors.popupfiltermode.contains;//

this.gltxtcountryorigin.texteditstyle =devexpress.xtraeditors.controls.texteditstyles.standard;

//數量單位

var mienu_quantityunits = quantityunitsbll.getquantityunitslist().orderby(o => o.qucode).tolist();//

數量單位

this.gltxtnumberunits.datasource =mienu_quantityunits;

this.gltxtnumberunits.nulltext = ""

;

this.gltxtnumberunits.displaymember = "

qucode";

this.gltxtnumberunits.valuemember = "

qucode";

this.gltxtnumberunits.allownullinput =devexpress.utils.defaultboolean.true;

this

.gltxtnumberunits.view.bestfitcolumns();

this.gltxtnumberunits.showfooter = false

;

this.gltxtnumberunits.view.optionsview.showautofilterrow = true; //

顯示不顯示grid上第乙個空行,也是用於檢索的應用

= false;

this.gltxtnumberunits.immediatepopup = true;///

/在輸入框按任一可見字元鍵時立即彈出下拉窗體

this.gltxtnumberunits.popupfiltermode = devexpress.xtraeditors.popupfiltermode.contains;//

this.gltxtnumberunits.texteditstyle =devexpress.xtraeditors.controls.texteditstyles.standard;

#endregion

單元格屬性設定

gridview合併單元格

大家gridview都用的比較多吧.有沒遇到單元格需要合併的需求.單元格合併原理其實很簡單,就是逐行判斷要合併的單元格裡的值是否和上一行的相同,要是相同的話就合併,不同的話就接著判斷 我們可以通過擴充套件方法為gridview新增單元合併 我為gridview 建立了個rowspan的方法 有乙個o...

GridView中合併單元格

using system using system.collections.generic using system.linq using system.web using system.data using system.web.ui.webcontrols gridviewmergecell 合...

GridView中合併單元格

using system using system.collections.generic using system.linq using system.web using system.data using system.web.ui.webcontrols gridviewmergecell 合...