I trying to bind and assign a selected value to a rad combo box in rad grad
This is in popup edit mode. the combo box is referencing another table, and I wish to bind this progmatically.
I am calling 'OnItemsRequested' which binds the dropdown on request but I need it to bind and select the selected value when form is displayed.
Any suggestion would be great.
Thanks
Paul
This is in popup edit mode. the combo box is referencing another table, and I wish to bind this progmatically.
I am calling 'OnItemsRequested' which binds the dropdown on request but I need it to bind and select the selected value when form is displayed.
<EditFormSettings CaptionFormatString="Group form" EditFormType="Template" EditColumn-CancelImageUrl="../img/grid/Cancel.gif" |
CaptionDataField="GroupName"> |
<FormStyle BackColor="#eef1ba" BorderColor="#3b3b3a" BorderWidth="1" BorderStyle="Solid" /> |
<FormTemplate> |
<div class="Editform"> |
<!-- Business unit --> |
<div id="group"> |
<label> |
<asp:Label ID="lblGroup" runat="server" Text="Group name: "></asp:Label></label> |
<asp:TextBox ID="txtBusinessUnit" runat="server" CssClass="textInput" Width="200" |
TabIndex="1" Text='<%# Bind( "GroupName") %>'></asp:TextBox> |
</div> |
<br style="clear: both;" /> |
<!-- Message of the day --> |
<div id="messageoftheday"> |
<label> |
<asp:Label ID="lblMessageoftheday" runat="server" Text="Message of the day: "></asp:Label></label> |
<asp:TextBox ID="txtMessageoftheday" runat="server" TextMode="MultiLine" Height="100" |
Width="300" CssClass="textInput" TabIndex="1" Text='<%# Bind( "MessageOfTheDay") %>'></asp:TextBox> |
<br style="clear: both;" /> |
</div> |
<br style="clear: both;" /> |
<!-- Business unit --> |
<div id="businessunit"> |
<label> |
<asp:Label ID="lblBusinessUnit" runat="server" Text="Business unit: "></asp:Label></label> |
<telerik:RadComboBox ID="rcbBuisinessUnit" runat="server" DataTextField="BusinessUnit" DataValueField="BusinessUnitId" OnItemsRequested="rcbBuisinessUnit_ItemsRequested" EnableLoadOnDemand="true" width="300" EnableEmbeddedSkins="False" |
Skin="Default" ShowToggleImage="true"> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</telerik:RadComboBox> |
<br style="clear: both;" /> |
</div> |
<!-- Archive --> |
<div id="archive"> |
<label> |
<asp:Label ID="lblArchive" runat="server" Text="Archive"></asp:Label> |
</label> |
</div> |
<asp:CheckBox ID="chkArchive" runat="server" Checked='<%# (DataBinder.Eval(Container.DataItem,"Archive").ToString()!="False"?true:false) %>' /> |
<telerik:GridCheckBoxColumnEditor ID="GridCheckBoxColumnEditor1" runat="server"> |
</telerik:GridCheckBoxColumnEditor> |
<div style="clear: both"> |
<!-- Update/Cancel/Insert --> |
<label> |
</label> |
<cc1:EIB ID="btnUpdate" runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' |
CssClass="btn" ToolTip="Insert" ImageUrl='<%# (Container is GridEditFormInsertItem) ? "../img/btn/insert.gif" : "../img/btn/update.gif" %>' |
MouseOutImage='<%# (Container is GridEditFormInsertItem) ? "../img/btn/insert.gif" : "../img/btn/update.gif" %>' |
MouseOverImage='<%# (Container is GridEditFormInsertItem) ? "../img/btn/insert-over.gif" : "../img/btn/update-over.gif" %>' |
Height="22px" Width="77px" /> |
<cc1:EIB ID="btnCancel" runat="server" CommandName="Cancel" CssClass="btn" ToolTip="Cancel" |
ImageUrl="../img/btn/cancel.png" MouseOutImage="../img/btn/Cancel.png" MouseOverImage="../img/btn/Cancel-over.png" |
Height="22px" Width="77px" /> |
<!-- End Upade/Cancel/Insert --> |
</div> |
<div id="errorGrid"> |
<asp:Label ID="lblError" runat="server"></asp:Label> |
</div> |
</FormTemplate> |
<PopUpSettings ScrollBars="Auto" Height="400" Width="500"></PopUpSettings> |
</EditFormSettings> |
protected void rcbBuisinessUnit_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) |
{ |
Data.vaccineprofessionalDataContext db = new Data.vaccineprofessionalDataContext(); |
var results = db.vpBusinessUnitSeach("", "UnArchive"); |
RadComboBox comboBox = (RadComboBox)sender; |
comboBox.DataSource = results; |
comboBox.DataBind(); |
} |
Any suggestion would be great.
Thanks
Paul