ASP.NET-C#: Inserting const into TextBox in Gridview

Posted by dash on Stack Overflow See other posts from Stack Overflow or by dash
Published on 2012-10-07T15:18:38Z Indexed on 2012/10/07 15:37 UTC
Read the original article Hit count: 297

I have some problems inserting a const "1" into a textbox which is gridviw.

the gridview code:

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" EnableViewState="False">
        <Columns>
        <asp:BoundField DataField="Price" HeaderText="Price" ItemStyle-CssClass="price" >

<ItemStyle CssClass="price"></ItemStyle>
            </asp:BoundField>

                         <asp:TemplateField HeaderText="ProductID">
                <ItemTemplate>
                    <asp:Label ID="lblID" runat="server" Text='<%# Eval("ProductID") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
             <asp:TemplateField HeaderText="ProductName">
                <ItemTemplate>
                    <asp:Label ID="lblName" runat="server" Text='<%# Eval("ProductName") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>

             <asp:TemplateField HeaderText="Summary">
                <ItemTemplate>
                    <asp:Label ID="lblSum" runat="server" Text='<%# Eval("Summary") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
             <asp:TemplateField HeaderText="picPath">
                <ItemTemplate>
                    <asp:Label ID="lblPic" runat="server" Text='<%# Eval("picPath") %>' ></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:TemplateField HeaderText = "quantity">
            <ItemTemplate>
                <asp:TextBox ID="lblquantity" runat="server" ></asp:TextBox>

            </ItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText = "Total">
            <ItemTemplate>
                <asp:Label ID="lblTotal" runat="server" ></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>



        </Columns>
    </asp:GridView>

All the information is populated from the session of the privious page, beside this textbox which doesnt comes from anywhere, its a quantity textbox which the user should enter. and i want it to have a defalt value of "1". I dont actually know how to insert into a textbox which is in the gridview. please help me. thanx

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET