winform tablelayoutpanel_table.render

winform tablelayoutpanel_table.render*******************CreateTable******************* dtData.Rows.Clear(); //DetailTable publicstaticvoidAddColumns(refDataTabletable) { table.Columns.Add(“BusinessType”,typeof(string…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

 ******************* Create Table *******************

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)

{
if (e.CommandName == “Delete”)
{
AddColumns(ref dtData);
int intRow=0;
foreach(DataGridItem dgi in dg_FCL.Items)
{
intRow += 1;
DataRow dr1 = dtData.NewRow();
dr1[“BusinessType”]=((DropDownList)(dgi.FindControl(“dropBusinessType”))).SelectedValue;
dr1[“BusinessUnit”]=((DropDownList)(dgi.FindControl(“dropBusinessUnit”))).SelectedValue;
dr1[“SourceCode”]=((DropDownList)(dgi.FindControl(“dropSourceCode”))).SelectedValue;
dr1[“UserName”]=((TextBox)(dgi.FindControl(“txtUserName”))).Text.ToString();
dr1[“SONO”]=((TextBox)(dgi.FindControl(“txtSONO”))).Text.ToString();
dr1[“CustomerCode_Market”]=((TextBox)(dgi.FindControl(“txtCustomerCode_Market”))).Text.ToString();
dr1[“Customer_Plantid”]=((TextBox)(dgi.FindControl(“txtCustomer_Plantid”))).Text.ToString();
dr1[“InvoiceNo”]=((TextBox)(dgi.FindControl(“txtInvoiceNo”))).Text.ToString();
dr1[“OCNO_PLNo”]=((TextBox)(dgi.FindControl(“txtOCNO_PLNo”))).Text.ToString();
dr1[“ItemNo”]=((TextBox)(dgi.FindControl(“txtItemNo”))).Text.ToString();
dr1[“PCS”]=((TextBox)(dgi.FindControl(“txtPCS”))).Text.ToString();
dr1[“CTNS”]=((TextBox)(dgi.FindControl(“txtCTNS”))).Text.ToString();
dr1[“CBM”]=((TextBox)(dgi.FindControl(“txtCBM”))).Text.ToString();
dr1[“KGS”]=((TextBox)(dgi.FindControl(“txtKGS”))).Text.ToString();
dr1[“ClosingDate”]=((TextBox)(dgi.FindControl(“txtClosingDate”))).Text.ToString();
dr1[“JobNO”]=((TextBox)(dgi.FindControl(“txtJobNO”))).Text.ToString();
dr1[“DestinationID”]=((DropDownList)(dgi.FindControl(“dropDestinationID”))).SelectedValue;
dr1[“Status”]=((Label)(dgi.FindControl(“lblHEStatus”))).Text.ToString();
dtData.Rows.Add(dr1);
}
dtData.Rows.Remove(dtData.Rows[e.Item.ItemIndex]);

this.dg_FCL.Visible = true;
this.dg_FCL.DataSource = dtData.DefaultView;
this.dg_FCL.DataBind();
}
}

 

 ****************** 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 ?’);”);

}

}

 

 

转载于:https://www.cnblogs.com/zhangchenliang/archive/2010/08/16/1800561.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/182495.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号