Rake$h 0 Newbie Poster

hi friend here soved code for textbox data display in Gridview

<form id="form1" runat="server">
<asp:TextBox ID="txtAdd1" runat="server"></asp:TextBox>
<asp:TextBox ID="txtAdd2" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="show in gridview" 
    onclick="Button1_Click" /><br />
<asp:GridView ID="GridView1" runat="server">

  <Columns>                            
            <asp:TemplateField HeaderText="Select">
                <ItemTemplate>
                    <asp:CheckBox ID="chkbox" runat="server"></asp:CheckBox>
                    <br />
                </ItemTemplate>
            </asp:TemplateField>
                        <asp:TemplateField HeaderText="Remark">
                <ItemTemplate>
                  <asp:Label ID="lblremark" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            </Columns>

</asp:GridView>
<asp:Button ID="Button2" runat="server" Text="save in db" 
    onclick="Button2_Click" />
&nbsp;
<div>
    </div>
    <br />
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>

** Code:**

 DataTable dt;
    protected void Page_Load(object sender, EventArgs e)
    {
            dt = new DataTable("tblTest");

        DataColumn dc1 = new DataColumn();
            dc1.DataType = typeof(String);
            dc1.ColumnName = "Pf";

        DataColumn dc2 = new DataColumn();
            dc2.DataType = typeof(String);
            dc2.ColumnName = "loan";



            dt.Columns.Add(dc1);
            dt.Columns.Add(dc2);

    }
        protected void Button1_Click(object sender, EventArgs e)
    {
        Session["Name"] += txtAdd1.Text + "|";
        Session["Address"] += txtAdd2.Text + "|";

        CreateTable();

    }


 public void CreateTable()
{
            string[] sa = Session["Name"].ToString().Split('|');
            string[] sb = Session["Address"].ToString().Split('|');
                 int recordnum = sa.Length;

            for (int j = 0; j < recordnum - 1; j++)
            {

            DataRow dr = dt.NewRow();
            dr["Name"] = sa[j].ToString();
            dr["Address"] = sb[j].ToString();
              dt.Rows.Add(dr);

            }

            GridView1.DataSource = dt.DefaultView;
            GridView1.DataBind(); 
    }