Hi,
I'm trying to use the user control as the edit form, this is working fine but now I want to generate the input boxes from code behind on page load as this is a dynamic input form. Unfortunately I'm having problems them to bind with the Container object as this only seems to exist when declaring it in the aspx. Is there anyway to get hold of this object from code behind? maybe from the Page object (which references the container page with the grid on it) or by passing it in as properties/eventargs on the user control.
Here is my user control code example..
public partial class WebUserControls_EditForm : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox txt1 = new TextBox();
txt1.Text = DataBinder.Eval(Container, "DataItem.Txt1").ToString();
this.Controls.Add(txt1);
}
}
I'm trying to use the user control as the edit form, this is working fine but now I want to generate the input boxes from code behind on page load as this is a dynamic input form. Unfortunately I'm having problems them to bind with the Container object as this only seems to exist when declaring it in the aspx. Is there anyway to get hold of this object from code behind? maybe from the Page object (which references the container page with the grid on it) or by passing it in as properties/eventargs on the user control.
Here is my user control code example..
public partial class WebUserControls_EditForm : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox txt1 = new TextBox();
txt1.Text = DataBinder.Eval(Container, "DataItem.Txt1").ToString();
this.Controls.Add(txt1);
}
}