Monday, November 15, 2010

Creating Table dynamically in codebehind C#

.CS Code:
DataTable table = new DataTable();
table.Columns.Add("Name", typeof(string));
table.Columns.Add("MemberType", typeof(string));
table.Rows.Add(membername, membertype);
DataSet myds = new DataSet();
 test.DataSource = myds;
.ASPX Code:
<table >
                    <asp:GridView ID="test" AutoGenerateColumns="false" runat="server" ShowHeader="false" GridLines="None">
                   asp:BoundField DataField="Name" />
                    <asp:BoundField DataField="MemberType" />

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Online Training from India. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
    JavaScript Online Training from India