這是我自己使用選擇打印時獲取選擇項的一點代碼希望對用到的朋友有幫助,有高手請指點怎麼能選擇多個從表的內容
private void metroButton1_Click(object sender, EventArgs e)
{string ids = "";
for (int j = 0; j < detailView.RowCount; j++)
{
//在dev 11版本中 DevExpress.XtraGrid.Demos演示程序中有一個 GridUnboundMasterViewClass.cs
//ChildRecordCustomer 是裏面聲明的 我用來填充主從表數據用,找到演示demo可以直接用
bool text = s.操作; //選擇的checkbox 值
if (text == true)
{
if (ids == "")
ids = s.序號;// 這裏是id
else
ids = ids + "," + s.序號;
}
}
//獲取展開的父 grid 只是獲取展開的 這裏是百度到的
GridView detailView;
private void gridView1_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e)
{
detailView = gridView1.GetDetailView(e.RowHandle, e.RelationIndex) as GridView;
}