datagrid和repeader控件中替換標(biāo)識(shí)值的方法
來(lái)源:易賢網(wǎng) 閱讀:986 次 日期:2014-08-15 15:27:56
溫馨提示:易賢網(wǎng)小編為您整理了“datagrid和repeader控件中替換標(biāo)識(shí)值的方法”,方便廣大網(wǎng)友查閱!

DataGrid控件中替換標(biāo)識(shí)值的使用:

01 <asp:DataGrid ID="dgList" runat="server" Width="100%" AutoGenerateColumns="False">

02 <Columns>

03 <asp:BoundColumn DataField="COP_G_NO" HeaderText="物料號(hào)/成品貨號(hào)"></asp:BoundColumn>

04 <asp:BoundColumn DataField="QTY" HeaderText="數(shù)量"></asp:BoundColumn>

05 <asp:TemplateColumn HeaderText="物料標(biāo)識(shí)">

06 <ItemTemplate>

07 <%#GetTransType(DataBinder.Eval(Container.DataItem, "FLAG"))%>

08 </ItemTemplate>

09 </asp:TemplateColumn>

10 </Columns>

11 </asp:DataGrid>

12 直接調(diào)用后臺(tái)方法:

13 <asp:TemplateColumn HeaderText="原產(chǎn)地">

14 <ItemTemplate>

15 <%# (Common.Constant.CountryList.ContainsKey(Eval("COUNTRY") + "")) ? Common.Constant.CountryList[Eval("COUNTRY") + ""] : Eval("COUNTRY") + "" %>

16 </ItemTemplate>

17 </asp:TemplateColumn>

view sourceprint?01 public string GetTransType(object obj)

02 {

03 string type_flag = Convert.ToString(obj);

04 string strReturn = "";

05 switch (type_flag)

06 {

07 case "1": strReturn = "在廠產(chǎn)品"; break;

08 case "2": strReturn = "在廠半成品"; break;

09 case "3": strReturn = "已出庫(kù)未報(bào)關(guān)成品"; break;

10 case "I": strReturn = "在廠原材料數(shù)量"; break;

11 case "Y": strReturn = "已報(bào)關(guān)未入庫(kù)料件數(shù)量"; break;

12 case "W": strReturn = "已入庫(kù)未報(bào)關(guān)料件數(shù)量"; break;

13 default: ; break;

14 }

15 return strReturn;

16 }

repeader控件中替換標(biāo)識(shí)值的方法:

01 <asp:Repeater ID="rp_List" runat="server" OnItemCommand="rp_List_ItemCommand">

02 <ItemTemplate>

03 <tr>

04 <td>

05 <input id="chk" type="checkbox" name="chkName" runat="server" />

06 </td>

07 <td width="70">

08 <asp:HyperLink NavigateUrl='<%# getLink(Eval("CodeNameCn"),Eval("Guid"))%>' ID="hl_guid"

09 runat="server"><%# Eval("OrderNo")%></asp:HyperLink>

10 </td>

11 <td>

12 <%# Eval("CustomerNo")%><asp:HiddenField ID="hf_OrderNo" Value='<%# Eval("Guid") %>'

13 runat="server" />

14 </td>

15 <td>

16 <%# getInOrOut(Eval("IeType"))%>

17 </td>

18 <td>

19 <%# Eval("TradeMode")%>

20 </td>

21 <td>

22 <%# Eval("TotalQuantity")%>

23 </td>

24 <td>

25 <%# Eval("TotalAmount")%>

26 </td>

27 <td>

28 <%# Eval("ShipPeople")%>

29 </td>

30 <td>

31 <%# Eval("ReceivePeople")%>

32 </td>

33 <td>

34 <asp:LinkButton ID="lb_xiadan" runat="server" CommandName="xiadan"><%#getIsShowXiadan(Eval("Status"))%></asp:LinkButton>

35 </td>

36 <td>

37 <%# GetExistService(Eval("HasWMSService"), Eval("HasFreightAgent"), Eval("HasCustomsClearance"))%>

38 </td>

39 <td>

40 <%# Eval("CodeNameCn")%>

41 </td>

42 <td>

43 <%# Convert.ToDateTime(Eval("CreateTime")).ToString("yyyy-MM-dd")%>

44 </td>

45 </tr>

46 </ItemTemplate>

47 </asp:Repeater>

C#后臺(tái)方法:

01 public string getLink(object objStatus, object objGuid)

02 {

03 if (objStatus == null)

04 {

05 return "#";

06 }

07 else if (objStatus + "" == "未下單")

08 {

09 return "GjmyOrderSave.aspx?guid=" + objGuid;

10 }

11 else

12 {

13 return "GjmyOrderDetail.aspx?guid=" + objGuid;

14 }

15 }

01 public string GetExistService(object objHasWMSService, object objHasFreightAgent, object objHasCustomsClearance)

02 {

03 string serviceHtml = "";

04 if (objHasWMSService != DBNull.Value)

05 {

06 if (Convert.ToBoolean(objHasWMSService) == true)

07 {

08 serviceHtml += " 倉(cāng)庫(kù)發(fā)貨 ";

09 }

10 }

11

12 if (objHasFreightAgent != DBNull.Value)

13 {

14 if (Convert.ToBoolean(objHasFreightAgent) == true)

15 {

16 serviceHtml += " 貨運(yùn)代理 ";

17 }

18 }

19

20 if (objHasCustomsClearance != DBNull.Value)

21 {

22 if (Convert.ToBoolean(objHasCustomsClearance) == true)

23 {

24 serviceHtml += " 報(bào)關(guān)報(bào)檢 ";

25 }

26 }

27 return serviceHtml;

28 }

更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄

更多信息請(qǐng)查看網(wǎng)絡(luò)編程
易賢網(wǎng)手機(jī)網(wǎng)站地址:datagrid和repeader控件中替換標(biāo)識(shí)值的方法
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢(xún)回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門(mén)公布的正式信息和咨詢(xún)?yōu)闇?zhǔn)!

2025國(guó)考·省考課程試聽(tīng)報(bào)名

  • 報(bào)班類(lèi)型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢(xún) | 簡(jiǎn)要咨詢(xún)須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專(zhuān)用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢(xún)關(guān)注公眾號(hào):hfpxwx
咨詢(xún)QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專(zhuān)用圖標(biāo)