I have DropdownList and after user select from it, it generates Gridview from db ( the db table depends on dropdownlist selectedindex). I want to add CalendarExtender to dynamic cell( in c# code without html) which has "start" as a column name.
My code:
if (DataTable.Columns[i].ToString() == "start_date_time")
{
TxtBox.ID = DataTable.Columns[i].ToString();
TxtBox.ClientIDMode = System.Web.UI.ClientIDMode.Static;
DBTableGrid.Rows[0].Cells[i+1].Controls.Add(TxtBox);
CalendarExtender CalendarExtender1 = new CalendarExtender();
CalendarExtender1.TargetControlID = TxtBox.ID;
CalendarExtender1.ID = "CalendarExtender1"+i;
CalendarExtender1.Format = "dd/MM/yyyy";
DBTableGrid.Rows[0].Cells[i + 1].Controls.Add(CalendarExtender1);
}
I have button that Add new row with empty Textboxes and DropdownList.When i click on it, it shows that row.But after add DBTableGrid.Rows[0].Cells[i + 1].Controls.Add(CalendarExtender1); that row is not showing.
What can i do? Thank you for your time.