Hello Friends,
As i shown above image . i want to design table dynamically as user required.
Now take example of above table 2 column table .
For Column is written Class as Columns.cs as below
public class Columns
{
public List<Columns> rCol { set; get; }
Columns mCurrentColumn1;
public Columns()
{
rCol = new List<Columns>();
}
public string ColName { set; get; }
public string Value { set; get; }
public Columns AddColumn(string ColName, String Value)
{
mCurrentColumn1 = new Columns();
mCurrentColumn1.ColName = ColName;
mCurrentColumn1.Value = Value;
rCol.Add(mCurrentColumn1);
return mCurrentColumn1;
}
}
For AddColumn is written Class as AddColumn.cs as below
public class AddColumn
{
public List<AddColumn> rCol1 { set; get; }
AddColumn mCurrentColumn2;
public AddColumn()
{
rCol1 = new List<AddColumn>();
}
public void AddCol(Columns AddCol)
{
mCurrentColumn2 = new AddColumn();
mCurrentColumn2.AddCol(AddCol);
rCol1.Add(mCurrentColumn2);
}
}
For AddRow is written Class as AddRow.cs as below
public class AddRow
{
public List<AddRow> rCol2 { set; get; }
AddRow mCurrentColumn3;
public AddRow()
{
rCol2 = new List<AddRow>();
}
public void AddColumn(AddColumn AddCol)
{
mCurrentColumn3 = new AddRow();
mCurrentColumn3.AddColumn(AddCol);
rCol2.Add(mCurrentColumn3);
}
}
public partial class Default : System.Web.UI.Page
{
Columns Col = new Columns();
AddColumn ACol = new AddColumn();
AddRow ARow = new AddRow();
protected void Page_Load(object sender, EventArgs e)
{
Col.AddColumn("MainHeader1", "State Bank of India");
Col.AddColumn("MainHeader2", "State Bank of India");
Col.AddColumn("MainHeader3", "State Bank of India");
ACol.AddCol(Col);
ARow.AddColumn(ACol);
}
}
When i run program in AddRow.cs class showing error as
"An unhandled exception of type 'System.StackOverflowException' occurred in"