dtData.Rows.Clear();
//Detail Table
public static void AddColumns(ref DataTable table)
{
table.Columns.Add("BusinessType",typeof(string));
table.Columns.Add("BusinessUnit",typeof(string));
table.Columns.Add("SourceCode",typeof(string));
table.Columns.Add("UserName",typeof(string));
table.Columns.Add("SONO",typeof(string));
table.Columns.Add("CustomerCode_Market",typeof(string));
table.Columns.Add("Customer_Plantid",typeof(string));
table.Columns.Add("InvoiceNo",typeof(string));
table.Columns.Add("OCNO_PLNo",typeof(string));
table.Columns.Add("ItemNo",typeof(string));
table.Columns.Add("PCS",typeof(string));
table.Columns.Add("CTNS",typeof(string));
table.Columns.Add("CBM",typeof(string));
table.Columns.Add("KGS",typeof(string));
table.Columns.Add("ClosingDate",typeof(string));
table.Columns.Add("JobNO",typeof(string));
table.Columns.Add("DestinationID",typeof(string));
table.Columns.Add("Status",typeof(string));
}
public static void updColumns(ref DataTable table)
{
table.Columns.Add("BusinessType",typeof(string));
table.Columns.Add("BusinessUnit",typeof(string));
table.Columns.Add("SourceCode",typeof(string));
table.Columns.Add("UserName",typeof(string));
table.Columns.Add("SONO",typeof(string));
table.Columns.Add("CustomerCode_Market",typeof(string));
table.Columns.Add("Customer_Plantid",typeof(string));
table.Columns.Add("InvoiceNo",typeof(string));
table.Columns.Add("OCNO_PLNo",typeof(string));
table.Columns.Add("ItemNo",typeof(string));
table.Columns.Add("PCS",typeof(string));
table.Columns.Add("CTNS",typeof(string));
table.Columns.Add("CBM",typeof(string));
table.Columns.Add("KGS",typeof(string));
table.Columns.Add("ClosingDate",typeof(string));
table.Columns.Add("JobNO",typeof(string));
table.Columns.Add("DestinationID",typeof(string));
table.Columns.Add("FID",typeof(string));
table.Columns.Add("Status",typeof(string));
}
****************** Datagrid ItemCommand Operator **************************
DataRow[] drsDel = dtData.Select(string.Format("FID in ({0})", FID.ToString()));
//直接在集合中删除 foreach (DataRow drDel in drsDel)
{ dtData.Rows.Remove(drDel); }
if( FID > 0)
{ m_objSQLBLL.DeleteTADetail(FID.ToString());
txtHiddenFID.Value += FID.ToString() + ","; }
private void dg_FCL_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
****************** Datagrid ItemDataBound Operator **************************
private void dg_FCL_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
DropDownList listBusinessType = new DropDownList();
listBusinessType= (DropDownList)(e.Item.FindControl("dropBusinessType"));
DataView dv = m_objSQLBLL.GetBusinessType();
if ( !( ViewState[Constants.VENDOR_CODE].ToString().Trim() == "09420" || ViewState[Constants.VENDOR_CODE].ToString().Trim() == "09421"
|| ViewState[Constants.VENDOR_CODE].ToString().Trim() == "09422" || ViewState[Constants.VENDOR_CODE].ToString().Trim() == "09415"
|| ViewState[Constants.VENDOR_CODE].ToString().Trim() == "09407"
) )
{
dv.RowFilter = " BusinessType in ('DI-US','DI-INT','TRADE')";
}
listBusinessType.DataSource = dv;
listBusinessType.DataTextField = "BusinessName";
listBusinessType.DataValueField = "BusinessType";
listBusinessType.DataBind();
listBusinessType.SelectedValue = ((string)DataBinder.Eval(e.Item.DataItem, "BusinessType"));
DropDownList listBusinessUnit = new DropDownList();
listBusinessUnit= (DropDownList)(e.Item.FindControl("dropBusinessUnit"));
DataView dvBusinessUnit = m_objSQLBLL.GetBusinessUnit();
listBusinessUnit.DataSource = dvBusinessUnit;
listBusinessUnit.DataTextField = "BusinessUnit";
listBusinessUnit.DataValueField = "BusinessUnit";
listBusinessUnit.DataBind();
listBusinessUnit.SelectedValue = ((string)DataBinder.Eval(e.Item.DataItem, "BusinessUnit"));
DropDownList listSourceCode = new DropDownList();
listSourceCode= (DropDownList)(e.Item.FindControl("dropSourceCode"));
DataView dvSourceCode = m_objSQLBLL.GetSourceCode();
listSourceCode.DataSource = dvSourceCode;
listSourceCode.DataTextField = "SourceCode";
listSourceCode.DataValueField = "SourceCode";
listSourceCode.DataBind();
listSourceCode.SelectedValue = ((string)DataBinder.Eval(e.Item.DataItem, "SourceCode"));
//20100328
DropDownList listDestinationID = new DropDownList();
listDestinationID= (DropDownList)(e.Item.FindControl("dropDestinationID"));
DataView dvDestination = m_objSQLBLL.GetDestinationForPlant();
listDestinationID.DataSource = dvDestination;
listDestinationID.DataTextField = "DestinationAddr";
listDestinationID.DataValueField = "DestinationID";
listDestinationID.DataBind();
listDestinationID.SelectedValue = ((string)DataBinder.Eval(e.Item.DataItem, "DestinationID"));
if(dg_FCL.Items.Count == 0)
{
((ImageButton)(e.Item.FindControl("Imagebutton1"))).Visible = false;
}
((ImageButton)(e.Item.FindControl("Imagebutton1"))).Attributes.Add("onclick", "return confirm('Are you sure to delete the record ?');");
}
}