Hi,
I want to select data from radgrid (see picture "selectdata.jpg") after that it will bind to MultiColumComboBox (see picture "multicolumcombobox.jpg") but it not work.
My code here
Thanks
I want to select data from radgrid (see picture "selectdata.jpg") after that it will bind to MultiColumComboBox (see picture "multicolumcombobox.jpg") but it not work.
My code here
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <script type="text/javascript"> function UpdateItemCountField(sender, args) { //set the footer text sender.get_dropDownElement().lastChild.innerHTML = "A total of " + sender.get_items().get_count() + " items"; } </script> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid2_Search"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel_Search_New" /> <telerik:AjaxUpdatedControl ControlID="RadGrid2_Search" /> <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel_Footer" /> <telerik:AjaxUpdatedControl ControlID="txtPrdtOrderNo" /> <telerik:AjaxUpdatedControl ControlID="RadComboBox_Plan" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server" Skin="WebBlue" /> <table cellspacing="10" width="100%"> <tr> <td class="style20"></td <td class="styleLbl">PrdtOrderNo: </td> <td class="styleTxtBox"> <asp:TextBox ID="txtPrdtOrderNo" runat="server" Width="150px" Visible="false" ></asp:TextBox> </td> <td> <telerik:RadAjaxPanel ID="RadAjaxPanel_Search_New" runat="server"> <asp:Button ID="btnSearch" runat="server" Text="¤é¹ËÒ" Width="100px" /> <asp:Button ID="btnNew" runat="server" Text="New" Width="100px" /> </telerik:RadAjaxPanel> </td> </tr> <tr> <td class="style20"></td> <td class="styleLbl">Plan : </td> <td class="styleTxtBox"> <telerik:RadComboBox runat="server" ID="RadComboBox_Plan" Height="150px" Width="200px" MarkFirstMatch="true" DataSourceID="SqlDataSource_Plan" DataValueField="planNo" EnableLoadOnDemand="true" HighlightTemplatedItems="true" AppendDataBoundItems="true" OnClientItemsRequested="UpdateItemCountField" OnDataBound="RadComboBox_Plan_DataBound" OnItemDataBound="RadComboBox_Plan_ItemDataBound" OnItemsRequested="RadComboBox_Plan_ItemsRequested" Skin="WebBlue"> <Items> <telerik:RadComboBoxItem Text="--Please Select--" Value="" Selected="true"/> </Items> <HeaderTemplate> <ul> <li class="col1">Plan No</li> <li class="col2">Plan Date</li> </ul> </HeaderTemplate> <ItemTemplate> <ul> <li class="col1"> <%#DataBinder.Eval(Container.DataItem, "planNo")%></li> <li class="col2"> <%#DataBinder.Eval(Container.DataItem, "date", "{0:dd/MM/yyyy}")%></li> </ul> </ItemTemplate> <FooterTemplate> A total of <asp:Literal runat="server" ID="RadComboItemsCount" /> items </FooterTemplate> </telerik:RadComboBox> <asp:SqlDataSource ID="SqlDataSource_Plan" runat="server" ConnectionString="<%$ ConnectionStrings:projectConnectionString %>" SelectCommand="SELECT planNo, date FROM [Plan] ORDER BY date"> </asp:SqlDataSource> </td> <td> <asp:RequiredFieldValidator runat="server" ID="ReqFieldValidate_ddlPlan" ControlToValidate="RadComboBox_Plan" ErrorMessage="*" ValidationGroup="ForSave" Display="Dynamic" InitialValue="--Please Select--" /> </td> </tr> </table> <table cellspacing="10" width="100%"> <tr> <td class="style20"></td <td colspan="2"> <telerik:RadGrid ID="RadGrid2_Search" runat="server" AllowAutomaticDeletes="True" AllowAutomaticUpdates="True" DataSourceID="SqlDataSource2_Search" AllowAutomaticInserts="True" AutoGenerateColumns="False" GridLines="None" Width="100%" Skin="WebBlue"> <ClientSettings EnablePostBackOnRowClick="true" EnableRowHoverStyle="true"> <Selecting AllowRowSelect="true" /> </ClientSettings> <MasterTableView DataKeyNames="prdtOrderNo, planNo, planDate, date, productNo, productName, qtyPrdtOrder, qtyProduce, status, remark" DataSourceID="SqlDataSource2_Search" NoMasterRecordsText="No records to display." AutoGenerateColumns="false" Name="ProductionOrder_Search"> <Columns> <telerik:GridBoundColumn DataField="prdtOrderNo" DefaultInsertValue="" HeaderText="prdtOrderNo" SortExpression="prdtOrderNo" UniqueName="prdtOrderNo" ReadOnly="True" Display="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="planNo" DefaultInsertValue="" HeaderText="planNo" SortExpression="planNo" UniqueName="planNo" ReadOnly="True"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="planDate" DefaultInsertValue="" HeaderText="planDate" SortExpression="planDate" UniqueName="planDate" DataFormatString="{0:dd/MM/yyyy}"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="date" DefaultInsertValue="" HeaderText="date" SortExpression="date" UniqueName="date" DataFormatString="{0:dd/MM/yyyy}"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="productName" DefaultInsertValue="" HeaderText="productName" SortExpression="productName" UniqueName="productName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="qtyPrdtOrder" DefaultInsertValue="" HeaderText="qtyPrdtOrder" SortExpression="qtyPrdtOrder" UniqueName="qtyPrdtOrder" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N}"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="qtyProduce" DefaultInsertValue="" HeaderText="qtyProduce" SortExpression="qtyProduce" UniqueName="qtyProduce" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N}"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="status" DefaultInsertValue="" HeaderText="status" SortExpression="status" UniqueName="status"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="remark" DefaultInsertValue="" HeaderText="remark" SortExpression="remark" UniqueName="remark" Visible="false"> </telerik:GridBoundColumn> </Columns> </MasterTableView> </telerik:RadGrid> <asp:SqlDataSource ID="SqlDataSource2_Search" runat="server" ConnectionString="<%$ ConnectionStrings:projectConnectionString %>" SelectCommand="SELECT ProductionOrder.prdtOrderNo, ProductionOrder.planNo, [Plan].date AS planDate, ProductionOrder.date, ProductionOrder.productNo, Product.productName, [Plan].qtyPlan, ProductionOrder.qtyPrdtOrder, ProductionOrder.qtyProduce, ProductionOrder.status, ProductionOrder.remark FROM [Plan] INNER JOIN Product ON [Plan].productNo = Product.productNo INNER JOIN ProductionOrder ON [Plan].planNo = ProductionOrder.planNo"> </asp:SqlDataSource> </td> </tr> </table> <center> <telerik:RadAjaxPanel ID="RadAjaxPanel_Footer" runat="server"> <asp:Button ID="btnSave" runat="server" Text="Save" Width="100px" ValidationGroup="ForSave" /> <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="100px"/> </telerik:RadAjaxPanel> </center> <asp:SqlDataSource ID="SqlDataSource_ddlProduct" runat="server" ConnectionString="<%$ ConnectionStrings:projectConnectionString %>" SelectCommand="SELECT productNo, productName FROM Product WHERE status = 'Active'"> </asp:SqlDataSource> </asp:Content> Protected Sub RadComboBox_Plan_DataBound(ByVal sender As Object, ByVal e As EventArgs) 'set the initial footer label CType(RadComboBox_Plan.Footer.FindControl("RadComboItemsCount"), Literal).Text = Convert.ToString(RadComboBox_Plan.Items.Count) End SubProtected Sub RadComboBox_Plan_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs) SqlDataSource_Plan.SelectCommand = "SELECT planNo, date FROM [Plan] ORDER BY date" RadComboBox_Plan.DataBind() End SubProtected Sub RadComboBox_Plan_ItemDataBound(ByVal sender As Object, ByVal e As RadComboBoxItemEventArgs) 'set the Text and Value property of every item 'here you can set any other properties like Enabled, ToolTip, Visible, etc. e.Item.Text = Convert.ToDateTime(DirectCast(e.Item.DataItem, DataRowView)("date").ToString()).ToString("dd/MM/yyyy") e.Item.Value = (DirectCast(e.Item.DataItem, DataRowView))("planNo").ToString() End SubPrivate Sub RadGrid2_Search_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid2_Search.SelectedIndexChanged '''' set header txtPrdtOrderNo.Text = RadGrid2_Search.SelectedItems(0).OwnerTableView.DataKeyValues(RadGrid2_Search.SelectedItems(0).ItemIndex)("prdtOrderNo") RadComboBox_Plan.SelectedValue = RadGrid2_Search.SelectedItems(0).OwnerTableView.DataKeyValues(RadGrid2_Search.SelectedItems(0).ItemIndex)("planNo") End SubThanks