#region動態(tài)生成gridview
站在用戶的角度思考問題,與客戶深入溝通,找到閻良網(wǎng)站設(shè)計與閻良網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗(yàn)好的作品,建站類型包括:網(wǎng)站建設(shè)、網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名申請、網(wǎng)頁空間、企業(yè)郵箱。業(yè)務(wù)覆蓋閻良地區(qū)。///<summary>
///動態(tài)生成gridview
///</summary>
///<paramname="strName">表名</param>
privatevoid BindGridView(stringstrName)
{
if(!string.IsNullOrEmpty(strName))
{
string strSql= string.Format(@"selecta.COLUMN_NAME, t.comments as filed
fromuser_col_comments t, user_tab_columns a
wheret.table_name = upper('{0}') and t.table_name = a.TABLE_NAME and t.column_name =a.COLUMN_NAME
order by filed", strName);
DataTabledt = OracleHelperImm.getDataTable(strSql);
if(dt != null && dt.Rows.Count > 0)
{
gridList.Columns.Clear();
BindFixed();
foreach (DataRow dr in dt.Rows)
{
if (strName == "OWT_blocnew")
{
if (dr[0].ToString() == "BLOC_NAME")
{
BoundField bfColumn = newBoundField();
bfColumn.DataField = dr[0].ToString();
bfColumn.HeaderText = dr[1].ToString();
gridList.Columns.Add(bfColumn);
}
}
else
{
if (dr[0].ToString() != "ID"&& dr[0].ToString() != "WORKORDER_ID")
{
BoundField bfColumn = newBoundField();
bfColumn.DataField = dr[0].ToString();
bfColumn.HeaderText = dr[1].ToString();
gridList.Columns.Add(bfColumn);
}
}
}
}
}
else
{
gridList.Columns.Clear();
BindFixed();
}
}
///<summary>
///工單固定列表
///</summary>
privatevoid BindFixed()
{
TemplateFieldtemplateField0 = new TemplateField();
templateField0.ItemTemplate = new chkItem1();
gridList.Columns.Add(templateField0);
BoundFieldbfColumn10 = new BoundField();
bfColumn10.DataField = "batch_no";
bfColumn10.HeaderText = "批次號";
gridList.Columns.Add(bfColumn10);
BoundFieldbfColumn11 = new BoundField();
bfColumn11.DataField = "order_id";
bfColumn11.HeaderText = "工單號";
gridList.Columns.Add(bfColumn11);
BoundFieldbfColumn1 = new BoundField();
bfColumn1.DataField = "ORDER_STATE";
bfColumn1.HeaderText = "工單狀態(tài)";
gridList.Columns.Add(bfColumn1);
BoundFieldbfColumn2 = new BoundField();
bfColumn2.DataField = "type_name";
bfColumn2.HeaderText = "工單類型";
gridList.Columns.Add(bfColumn2);
BoundFieldbfColumn3 = new BoundField();
bfColumn3.DataField = "CUSTOM_NO";
bfColumn3.HeaderText = "受理號碼";
bfColumn3.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
gridList.Columns.Add(bfColumn3);
BoundFieldbfColumn4 = new BoundField();
bfColumn4.DataField = "DEAL_NAME";
bfColumn4.HeaderText = "處理人";
gridList.Columns.Add(bfColumn4);
BoundFieldbfColumn5 = new BoundField();
bfColumn5.DataField = "CREATE_NAME";
bfColumn5.HeaderText = "創(chuàng)建人";
gridList.Columns.Add(bfColumn5);
BoundFieldbfColumn6 = new BoundField();
bfColumn6.DataField = "COM_NAME";
bfColumn6.HeaderText = "所屬縣市";
gridList.Columns.Add(bfColumn6);
BoundFieldbfColumn7 = new BoundField();
bfColumn7.DataField = "CREATE_DATE";
bfColumn7.HeaderText = "開始時間";
bfColumn7.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
gridList.Columns.Add(bfColumn7);
BoundFieldbfColumn8 = new BoundField();
bfColumn8.DataField = "LIMITED_TIME";
bfColumn8.HeaderText = "最后期限";
bfColumn8.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
gridList.Columns.Add(bfColumn8);
BoundFieldbfColumn9 = new BoundField();
bfColumn9.DataField = "DEAL_DATE";
bfColumn9.HeaderText = "分公司處理時間";
bfColumn9.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
gridList.Columns.Add(bfColumn9);
BoundFieldbfColumn13 = new BoundField();
bfColumn13.DataField = "no_answer";
bfColumn13.HeaderText = "無人接聽次數(shù)";
bfColumn13.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
gridList.Columns.Add(bfColumn13);
BoundFieldbfColumn14 = new BoundField();
bfColumn14.DataField = "user_reject";
bfColumn14.HeaderText = "用戶拒接次數(shù)";
bfColumn14.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
gridList.Columns.Add(bfColumn14);
BoundFieldbfColumn12 = new BoundField();
bfColumn12.DataField = "FINISH_DATE";
bfColumn12.HeaderText = "完成時間";
bfColumn12.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
gridList.Columns.Add(bfColumn12);
TemplateFieldtemplateField = new TemplateField();
templateField.HeaderText = "操作";
templateField.ItemTemplate =new chkItem();
gridList.Columns.Add(templateField);
}
publicclass chkItem :Control, ITemplate
{
publicvoid InstantiateIn(Controlcontainer)
{
HyperLinkchk = new HyperLink();
chk.ID = "chkItem";
chk.Text = "下載";
chk.ForeColor =System.Drawing.Color.Blue;
container.Controls.Add(chk);
}
}
publicclass chkItem1: Control, ITemplate
{
publicvoid InstantiateIn(Controlcontainer)
{
HtmlInputCheckBoxcb = new HtmlInputCheckBox();
cb.ID = "recid";
container.Controls.Add(cb);
}
}
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
標(biāo)題名稱:動態(tài)生成GridViewColumn-創(chuàng)新互聯(lián)
轉(zhuǎn)載來源:http://aaarwkj.com/article2/gjoic.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、網(wǎng)站策劃、手機(jī)網(wǎng)站建設(shè)、靜態(tài)網(wǎng)站、建站公司、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容