Hi,
I had a issue with accessing dynamic controls in destination.aspx, which i had created during runtime while populating them in a panel in source.aspx.
In source.aspx, i generate controls and fill them up in a panel, after that, this page was posted to destination.aspx. however, i am unable to retrieve my controls at the destination page.
Following are some of the ways i had tried.
//this does not work at all, i can't cast a control using a request, it only returns me a string.
TextBox temp = (TextBox)Request["TextBox2"];
//this work very well for static control, however, I'm not able to retrieve dynamic one
TextBox tempCheck = (TextBox)Page.PreviousPage.FindControl("TextBox2");
//As I had added the checkboxes i generated dynamically into a panel, i tried to retrieve the panel and cast it into a tempPanel, but it didn't work for my dynamic controls too.
Panel tempPanel = (Panel)Page.PreviousPage.FindControl("Panel1");
CheckBox tempCheckbox = (CheckBox)tempPanel.FindControl("myCheckboxId");
//this can only return me string value of control (on/off) for checkbox, not even text assign to checkbox. And for textboxes, yes, it can return me my string in the textfile.
string[] cntrol = Request.Form.ToString().Split('&');
Button1.Text = Request["1a"].ToString();
Does anyone know what might be the problem that my dynamic controls cannot be grab in my destination.aspx? I'm always getting null exception when i use the previouspage.findcontrol() method.
Thanks!
Regards