hi there.. I am a little confused on how/why some of my ctrls are able to use the SelectedValue = '<%# Bind() %>' and some are not.
The one that can bind is using an ObjectDataSource within the ascx:
The one that can bind is using an ObjectDataSource within the ascx:
| <telerik:RadComboBox ID="ComboDepartment" runat="server" |
| DataSourceID="CCentres" DataTextField="CC_desc" |
| DataValueField="CC_desc" SelectedValue='<%# Bind("department") %>'> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </telerik:RadComboBox> |
| <asp:ObjectDataSource ID="CCentres" runat="server" SelectMethod="GetData" TypeName="CC2TableAdapters.Cost_centresTableAdapter"> |
| <SelectParameters> |
| <asp:SessionParameter DefaultValue="1" Name="Empid" SessionField="empid" Type="String" /> |
| </SelectParameters> |
| </asp:ObjectDataSource> |
the one that is not working is the following
| <telerik:RadComboBox ID="ComboStatus" SelectedValue='<%#Bind("status") %>' runat="server"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </telerik:RadComboBox> |
the combo status is being built using the following code from within the formview_onload Event.
| Protected Sub FormView1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.Load |
| If FormView1.CurrentMode = FormViewMode.Insert And Not IsPostBack Then |
| Dim Status As RadComboBox = FormView1.FindControl("ComboStatus") |
| Status.DataSource = functions.NameValues("status") |
| Status.Items.Add(New RadComboBoxItem("Select")) |
| Status.AppendDataBoundItems = True |
| Status.DataTextField = "Name" |
| Status.DataValueField = "Value" |
| Status.DataBind() |
| end if |
| End Sub |
My preference is to populate the boxes from code but still them bound to the formview.. is this possible?
thanks
mac