如何在网格视图中绑定项目名称和价格值?请给我一个答案...... [英] How to bind a itemname and price value in grid view? Please give me an answer...

查看:48
本文介绍了如何在网格视图中绑定项目名称和价格值?请给我一个答案......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Guyz,



以下是我的设计页面,

Guyz,

Following is my design page,

<asp:GridView ID="porder" runat="server" AutoGenerateColumns="False" 

    CssClass="Gridview" 

    HeaderStyle-BackColor="#61A6F8" HeaderStyle-Font-Bold="true" 

    HeaderStyle-ForeColor="White" RowStyle-VerticalAlign = "Middle" 

    CellPadding="4" Height="16px" Width="984px" HorizontalAlign="Center" 

    Font-Names="Segoe UI Light" BackColor="White" BorderColor="#3366CC" 

    BorderStyle="None" BorderWidth="1px" DataKeyNames="itemname,u_price">
    <columns>                                                                       
        <asp:TemplateField HeaderText="Item Name"  ItemStyle-HorizontalAlign = "Center">
            <itemtemplate>
                <asp:Label ID = "lblname" runat= "server"> 
            </itemtemplate>
            <itemstyle horizontalalign="Center"></itemstyle>
		</asp:TemplateField>
                                    
        <asp:TemplateField HeaderText="Required Quantity"  ItemStyle-HorizontalAlign = "Center">
            <itemtemplate>
                <asp:TextBox ID="txtrqty" runat="server"  onfocus ="Change(this, event)" onblur ="Change(this, event)" />
            </itemtemplate>
            <itemstyle horizontalalign="Center"></itemstyle>
		</asp:TemplateField>
                                    
        <asp:TemplateField HeaderText="Unit Price"  ItemStyle-HorizontalAlign = "Center">                                        
            <itemtemplate> 
                <asp:Label ID= "lblprice" runat = "server" />
            </itemtemplate> 
            <itemstyle horizontalalign="Center"></itemstyle>
		</asp:TemplateField>

        <asp:TemplateField HeaderText="Tax(%)"  ItemStyle-HorizontalAlign = "Center">
            <itemtemplate>
                <asp:TextBox ID="txttax" runat="server"  onfocus ="Change(this, event)" onblur ="Change(this, event)" />
            </itemtemplate>
            <itemstyle horizontalalign="Center"></itemstyle>
		</asp:TemplateField>

        <asp:TemplateField HeaderText="Tax Amount"  ItemStyle-HorizontalAlign = "Center">                                        
            <itemtemplate>
                <asp:TextBox ID="txttamt" runat="server"  onfocus ="Change(this, event)" onblur ="Change(this, event)" />
            </itemtemplate>
            <itemstyle horizontalalign="Center"></itemstyle>
		</asp:TemplateField>

        <asp:TemplateField HeaderText="Total"  ItemStyle-HorizontalAlign = "Center">                                        
            <itemtemplate>
                <asp:TextBox ID="txttotal" runat="server" onfocus ="Change(this, event)" onblur ="Change(this, event)" />
            </itemtemplate>
            <itemstyle horizontalalign="Center"></itemstyle>
		</asp:TemplateField>
    </columns>
    <emptydatarowstyle horizontalalign="Center" verticalalign="Middle" />
    <footerstyle backcolor="#99CCCC" forecolor="#003399" />
    <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF"></HeaderStyle>
    <pagerstyle backcolor="#99CCCC" forecolor="#003399" HorizontalAlign="Left" />
    <rowstyle backcolor="White" forecolor="#003399" horizontalalign="Center" VerticalAlign="Middle" />
    <SelectedRowStyle BackColor="#009999" ForeColor="#CCFF99" Font-Bold="True" />
    <sortedascendingcellstyle backcolor="#EDF6F6" />
    <sortedascendingheaderstyle backcolor="#0D4AC4" />
    <sorteddescendingcellstyle backcolor="#D6DFDF" />
    <sorteddescendingheaderstyle backcolor="#002876" />
</asp:GridView>



我有一个带有上述字段的网格视图,我有一个带有项目的下拉列表id在ddl中选择itemid时是itemlist表的数据我想在网格视图中绑定一个itemname和price值你可以建议我如何在C#中编写这段代码我正在使用asp.net



谢谢&此致,

Arumugam M


I have a grid view with above fields and i have a dropdown which have an item id which is the data of itemlist table when choose a itemid in ddl i want to bind a itemname and price value in grid view guyz can u please suggest me to how can i write this code in C# i am using asp.net

Thanks & Regards,
Arumugam M

推荐答案

请按照以下链接:

http://www.ezineasp.net/post/ASP-Net-Bind-GridView-to-DataTable。 aspx [ ^ ]

http://code.msdn.microsoft.com/CSASPNETGridView-5b16ce70 [ ^ ]

http://msdn.microsoft.com/en-us/ library / fkx0cy6d%28v = vs.85%29.aspx [ ^ ]



查看过去的答案和文章:

将数据绑定到gridview [ ^ ]

GridView到DataTable [ ^ ]

C#ASP.NET 2.0中Gridview中的转发器 [ ^ ]



它应该足够开始;)
Please, follow the below links:
http://www.ezineasp.net/post/ASP-Net-Bind-GridView-to-DataTable.aspx[^]
http://code.msdn.microsoft.com/CSASPNETGridView-5b16ce70[^]
http://msdn.microsoft.com/en-us/library/fkx0cy6d%28v=vs.85%29.aspx[^]

See past answers and articles too:
bind datatable to gridview[^]
GridView to a DataTable[^]
Repeater within Gridview in C# ASP.NET 2.0[^]

It should be enough for start ;)


这篇关于如何在网格视图中绑定项目名称和价格值?请给我一个答案......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆