1 Attachment(s)
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
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!
Re: Adding Multiple rows to GridView
hi,
I am indeed using Asp.NET with ajax + update panel
i am glad that it's clear :D thanks sir:)
i am not sleeping tonight before i solve it hehe