A
Al Smith
I kind of understand how the below works, however I am trying to do it at runtime vrs design time.
<asp:TextBox id="TextBox1" runat="server" Text='<%# StateList.SelectedItem.Text %>'></asp:TextBox>
So what I really want to do is something like I show below.
In Page_Load I have:
TextBox txt;
txt= new TextBox();
Color clr = new Color() ;
clr = Color.DeepSkyBlue;
txt.BackColor = clr;
txt.Style["Left"] = 10 + "px";
txt.Style["Top"] = 200 + "px";
txt.Style["Width"] = 200 + "px";
txt.Style["Height"] = 80 + "px";
txt.Text = "<%# StateList.SelectedItem.Text %>"; // <--- Should I be able to do this at runtime?
PlaceHolder1.Controls.Add(txt);
And in aspx I have:
<asplaceholder id="PlaceHolder1" runat="server"></asplaceholder>
StateList is a list control but when setup using the PlaceHolder I do not get any binding to take place.
Thanks for your pointers!
Al
<asp:TextBox id="TextBox1" runat="server" Text='<%# StateList.SelectedItem.Text %>'></asp:TextBox>
So what I really want to do is something like I show below.
In Page_Load I have:
TextBox txt;
txt= new TextBox();
Color clr = new Color() ;
clr = Color.DeepSkyBlue;
txt.BackColor = clr;
txt.Style["Left"] = 10 + "px";
txt.Style["Top"] = 200 + "px";
txt.Style["Width"] = 200 + "px";
txt.Style["Height"] = 80 + "px";
txt.Text = "<%# StateList.SelectedItem.Text %>"; // <--- Should I be able to do this at runtime?
PlaceHolder1.Controls.Add(txt);
And in aspx I have:
<asplaceholder id="PlaceHolder1" runat="server"></asplaceholder>
StateList is a list control but when setup using the PlaceHolder I do not get any binding to take place.
Thanks for your pointers!
Al