G
gnewsgroup
This might have been discussed before, but I haven't been able to dig
it out.
I ask because I notice something interesting.
Suppose, I have the following controls in a web form.
<aspropDownList ID="DropDownList1" runat="server" > </
aspropDownList>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
Suppose, in Page_Load, I want to do:
Label1.Text = DropDownList1.SelectedItem.Text;
If I bind the DropDownList right in the aspx file through
SqlDataSource, Label1.Text is empty when I check out the application
in the browser.
If I bind the DropDownList in the code behind, and in Page_Load, I do:
BindTheDropDownList();
Label1.Text = DropDownList1.SelectedItem.Text;
Label1.Text does have the text value of the 0th item of the
DropDownList.
Therefore, I think that at Page_Load, the binding processes in the
ASPX file are not done yet. Am I right?
Thanks.
it out.
I ask because I notice something interesting.
Suppose, I have the following controls in a web form.
<aspropDownList ID="DropDownList1" runat="server" > </
aspropDownList>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
Suppose, in Page_Load, I want to do:
Label1.Text = DropDownList1.SelectedItem.Text;
If I bind the DropDownList right in the aspx file through
SqlDataSource, Label1.Text is empty when I check out the application
in the browser.
If I bind the DropDownList in the code behind, and in Page_Load, I do:
BindTheDropDownList();
Label1.Text = DropDownList1.SelectedItem.Text;
Label1.Text does have the text value of the 0th item of the
DropDownList.
Therefore, I think that at Page_Load, the binding processes in the
ASPX file are not done yet. Am I right?
Thanks.