Results 1 to 3 of 3

Thread: Adding Multiple rows to GridView

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    2

    Adding Multiple rows to GridView

    hi,
    I am having a scenario,where i am using GridView + Dataset as datasource + .NET2.0 + VB.NET 2005.
    I need to add more rows on runtime to GridView so
    i need to first read the data from dataset and fill my GridView and then have an Add button which adds a new row on click ( for each column).
    here is what i've done:
    i just added a textbox in <ItemTemplate> for each <TemplateField> column
    Code:
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Style="z-index: 106;
                left: 40px; position: absolute; top: 188px" CellPadding="4" ForeColor="#333333" GridLines="None">
    <Columns>
                    <asp:TemplateField HeaderText="Milestone">
                        <ItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Planned date">
                        <ItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Actual Date">
                        <ItemTemplate>
                            <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="% Complete">
                        <ItemTemplate>
                            <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Progress Date">
                        <ItemTemplate>
                            <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Comments">
                        <ItemTemplate>
                            <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                
                </Columns>
                
            </asp:GridView>
    Unfotunately i am not able to get it to work.
    i really need this to work and i apreciate your help.waiting for ur reply, thanks again
    PS: i included a gif file which demonstrates what i am intending to do
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width