| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 852 人关注过本帖
标题:模板列取不到值(C#)
只看楼主 加入收藏
serverserver
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-1-26
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
模板列取不到值(C#)
<table>
<tr style =" font :9pt; font-family :宋体;">
                                <td align="center" valign="top" colspan="2" style="" >
                                    <asp:GridView ID="gvShopCart" DataKeyNames ="CartID" runat="server"
                                        AutoGenerateColumns="False" PageSize="5" Width="95%" ForeColor="Transparent">
                                     <Columns>
                                        <asp:BoundField DataField="GoodsID" HeaderText="商品编号" ReadOnly="True">
                                             <ItemStyle HorizontalAlign="Center" />
                                             <HeaderStyle HorizontalAlign="Center" />
                                         </asp:BoundField>
                                         <asp:BoundField DataField="GoodsName" HeaderText="商品名称" ReadOnly="True">
                                             <ItemStyle HorizontalAlign="Center" />
                                             <HeaderStyle HorizontalAlign="Center" />
                                         </asp:BoundField>
                                      
                                         <asp:TemplateField HeaderText ="市场价">
                                             <HeaderStyle HorizontalAlign="Center" />
                                             <ItemStyle HorizontalAlign ="Center" />
                                             <ItemTemplate >
                                                 <%#DataBinder.Eval(Container.DataItem,"MarketPrice").ToString()%> ¥
                                             </ItemTemplate>   
                                         </asp:TemplateField>
                                        <asp:TemplateField HeaderText ="会员价">
                                             <HeaderStyle HorizontalAlign="Center" />
                                             <ItemStyle HorizontalAlign ="Center" />
                                             <ItemTemplate >
                                                 <%#DataBinder.Eval(Container.DataItem,"MemberPrice").ToString()%>
                                             
                                             </ItemTemplate>   
                                             
                                         </asp:TemplateField>
                                         <asp:TemplateField HeaderText ="商品重量">
                                             <HeaderStyle HorizontalAlign="Center" />
                                             <ItemStyle HorizontalAlign ="Center" />
                                             <ItemTemplate >
                                             <%#DataBinder.Eval(Container.DataItem, "GoodsWeight").ToString()%> <b>kg</b>
                                             </ItemTemplate>   
                                         </asp:TemplateField>
                                         <asp:BoundField DataField="Num" HeaderText="数量">
                                             <ItemStyle HorizontalAlign="Center" />
                                             <HeaderStyle HorizontalAlign="Center" />
                                         </asp:BoundField>
                                         
                                         <asp:TemplateField HeaderText ="小计">
                                             <HeaderStyle HorizontalAlign="Center" />
                                             <ItemStyle HorizontalAlign ="Center"/>
                                             <ItemTemplate >
                                             <%#DataBinder.Eval(Container.DataItem, "SumPrice").ToString()%> ¥
                                             </ItemTemplate>   
                                         </asp:TemplateField>
                                         
                                     </Columns>
                                    </asp:GridView></td>
                            </tr>
</table>

我想取到模板列"会员价"的值,敬请各位高手相助.
搜索更多相关主题的帖子: 模板 
2010-01-26 10:25
zhangwc
Rank: 2
等 级:论坛游民
帖 子:49
专家分:67
注 册:2008-6-11
收藏
得分:10 
其它模板列能取到值吗?
数据源没看到啊。
2010-01-26 11:22
xianfajushi
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:8
帖 子:527
专家分:690
注 册:2007-9-8
收藏
得分:10 
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)//信息显示编辑与删除
    {
        pages = Request["page"];
        LinkButton LBut2 = (LinkButton)DataList1.Items[0].FindControl("LinkButton2");
        LinkButton LBut3 = (LinkButton)DataList1.Items[0].FindControl("LinkButton3");
        if (Session["UserName"] != null)
        {
            if ( == "BianJi_getID")
            {
                if (LBut2 != null) { strID = Convert.ToInt16(()).ToString(); }
                if (TextBox9.Text != "") { Session["BaoChi"] = TextBox9.Text; }
                Response.Redirect("Gong_Dan_List.aspx?id=" + strID + "&page=" + pages + "");
            }

            if ( == "ShuanChu_getID")
            {
                if (LBut3 != null) { strID = Convert.ToInt16(()).ToString(); }
                ShuanChu_JiLu();
            }
        }
        else
        { Response.Redirect("../default.aspx"); }
    }

CheckBox chk = (CheckBox)DataList1.Items[0].FindControl("CheckBox1");

Control shousuoKJ = (Control)Master.FindControl("ContentPlaceHolder1");
        for (int Bi = 1; Bi <= 3; Bi++)
        { Button Bton = (Button)shousuoKJ.FindControl("Button" + Bi.ToString()); if (Bton != null) { Bton.Enabled = false; } }

LinkButton LBut3 = (LinkButton)Controls.Count[0].FindControl("LinkButton3");

----------------------------------------------------------------------------

<asp:LinkButton ID="LinkButton3" runat="server"
                                                                    CommandArgument='<%# DataBinder.Eval(Container.DataItem, "id")%>'
                                                                    CommandName="GuanLi_getID" Enabled="False" ToolTip="网站管理。">删除</asp:LinkButton>

2010-01-27 18:40
快速回复:模板列取不到值(C#)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029733 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved