Click here to Skip to main content
15,936,565 members
Please Sign up or sign in to vote.
3.50/5 (3 votes)
See more:
I have a gridview in my aspx page with few tamplate field(TextBox) column. I want user to input in those temp field at runtime. How to achive it?
<asp:GridView ID="gridViewExp" runat="server" AutoGenerateColumns="False" ShowHeaderWhenEmpty="true">

                            <asp:TemplateField HeaderText="Due Date">

 <asp:TextBox ID="txtDueDate" runat="server">
            <asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtDueDate" Format="dd/MM/yyyy">

                            <asp:TemplateField HeaderText="Description">

                                     <asp:TextBox ID="txtDesc" runat="server" TextMode="MultiLine">

                            <asp:TemplateField HeaderText="Charge Type">

                                    <asp:TextBox ID="txtChargeType" runat="server">

                            <asp:TemplateField HeaderText="Amount Due(INR)">

                                    <asp:TextBox ID="txtAmtDue" runat="server">

                            <asp:TemplateField HeaderText="Tax">

                                    <asp:TextBox ID="txtTax" runat="server">

                            <asp:TemplateField HeaderText="Amount Received(INR)">

                                    <asp:TextBox ID="txtAmtRecv" runat="server">

                            <asp:TemplateField HeaderText="Net Payble(INR)">

                                    <asp:TextBox ID="txtNetPayble" runat="server">


                                     <asp:Button ID="btnAddNewRow" runat="server" CssClass="button" Text="Add New Row" />

Thanks in advance
Updated 5-Jan-14 22:14pm
Sibasisjena 6-Jan-14 2:20am    
Can you please explain some more about your problem.
Charan_Kumar 6-Jan-14 4:04am    
use empty data template for grid view

For that you have to add dynamic table with gridview binding because when SP or query not return any value then gridview would be not display. So that's why you have to create dynamic table to show gridview.

Please add code on page load event

string name = "Name";

DataTable dt = new DataTable();

DataColumn dc = new DataColumn(name,typeof(System.String));

DataRow dr = dt.NewRow();
dr[name] = "No Record";

GridView1.DataSource = dt;
Share this answer
SumitChandra 7-Jan-14 6:41am    
Thank you all for your response.... Finally solved it with the help of you all
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900