hi,
I am koti, i am faceing the problem when "asign the table to view state".the table contains the dynamic created dropdownlist with different "ids".
i asign the table to view state crror comes as follows
asp.net
<asp:tabel ID="table1" runat="server">
codebehind
if (int.TryParse(TextBox1.Text.Trim(), out numOfColumns) && int.TryParse(TextBox2.Text.Trim(), out numOfRows))
{
GenerateTable(numOfColumns, numOfRows, "eng");
viewstate["ko"]=table1;
}
private void GenerateTable(int colsCount, int rowsCount, string cat)
{
try
{
for (int i = 0; i < rowsCount; i++)
{
TableRow row = new TableRow();
for (int j = 0; j < colsCount; j++)
{
TableCell cell = new TableCell();
DropDownList dl = new DropDownList();
FileUpload ful = new FileUpload();
dl.ID = cat + "dl_" + i + "Col_" + j;
ful.ID = cat + "ful_" + i + "Col_" + j;
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("select PaperName from [7Seas_News_displayT]", con);
da.Fill(ds, "[7Seas_News_displayT]");
con.Open();
cmd.CommandText = "select PaperName from [7Seas_News_displayT]";
DataTable dt = new DataTable();
dt.Load(cmd.ExecuteReader());
dl.DataSource = dt;
dl.DataTextField = "PaperName";
dl.DataBind();
con.Close();
table1.Controls.Add(dl);
table1.Controls.Add(ful);
}
}
}
catch
{
}
}
Type 'System.Web.UI.WebControls.Panel' in Assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable
if any one knows how to solve the this problem , please share the information for me.
Thanks In Advance.
/EDIT Inline code Format