Click here to Skip to main content
15,881,776 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have some textboxes. I want the user to enter their details using the given textboxes.
An lastly the system display the user input via table form.

What I have tried:

<asp:TextBox ID="TextBox1" runat="server">
<asp:TextBox ID="TextBox2" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" />
Posted
Updated 17-Apr-16 21:24pm
v2
Comments
Beginner Luck 18-Apr-16 2:50am    
what programming language you using ?? C# orjquery
Sergey Alexandrovich Kryukov 18-Apr-16 3:09am    
Totally wrong question, gibberish, makes no sense at all. Nothing to answer about.
—SA
Sergey Alexandrovich Kryukov 18-Apr-16 3:11am    
Table have nothing to do with databases. Generate any table you want, fill with data you want. The question makes no sense.
—SA

1 solution

In aspx Page add below code:
ASP.NET
<asp:GridView ID="GridView1" runat="server"></asp:GridView>


In aspx.cs (codebehind), add below code:

C#
using System;
using System.Data;

namespace ASP.Net
{
    public partial class Test2 : System.Web.UI.Page
    {
        private DataTable dt = new DataTable("TextEntry");
        protected void Page_Load(object sender, EventArgs e)
        {
            dt.Columns.Add("T1");
            dt.Columns.Add("T2");
            dt.ReadXml("c:\\Saved.xml");
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            DataRow dr = dt.NewRow();
            dr["T1"] = TextBox1.Text;
            dr["T2"] = TextBox2.Text;
            dt.Rows.Add(dr);
            dt.WriteXml("c:\\Saved.xml");
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
    }
}
 
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