Results 1 to 3 of 3

Thread: Adding Multiple rows to GridView

  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  

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Adding Multiple rows to GridView

    I would imagine this is going to require some client-side JavaScript but I don't know how that'll interface with your GridView unless you're using ASP.Net AJAX and an Update Panel.

    I do want to say that you, sir, are a shinning example of how people should describe their questions / issues. I love the gif!
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    2

    Re: Adding Multiple rows to GridView

    hi,
    I am indeed using Asp.NET with ajax + update panel
    i am glad that it's clear thanks sir
    i am not sleeping tonight before i solve it hehe

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