Fill out grid cells with radcombobox embedded in same grid.

2 posts, 0 answers
  1. Carlos
    Carlos avatar
    3 posts
    Member since:
    Aug 2012

    Posted 31 May 2012 Link to this post

    Hi guys,

    I working with a radgrid that contains in a column a rad Combobox with multiples columns where the user can search items. I wish when the user select an item found in the rad combobox, it must fill out the others cells in the same row. But all events fired after insert or edit command.

    Thanks in advance..

    Carlos


    This is my code:


    <telerik
    :RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" AllowMultiRowEdit="True" CellSpacing="0" Width="100%" Height="250px"

    OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand" OnDeleteCommand="RadGrid1_DeleteCommand"

    OnNeedDataSource="RadGrid1_NeedDataSource" OnRowDrop="RadGrid1_RowDrop" OnItemDataBound="RadGrid1_ItemDataBound"

    AllowPaging="True" GridLines="None" PageSize="20">

    <ClientSettings AllowRowsDragDrop="true">

    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />

    <ClientEvents

    OnGridCreated="GridCreated"

    OnRowDropping="RadGrid1_OnRowDropping"

    OnRowClick="RadGrid1_RowDblClick"

    OnRowDblClick="RadGrid1_RowDblClick"

    OnCommand="RadGrid1_GridCommand" />

    <Scrolling AllowScroll="true" />

    </ClientSettings>

    <MasterTableView Width="100%" HorizontalAlign="NotSet" DataKeyNames="ItemCode"

     

    ShowFooter="false" EditMode="InPlace" CommandItemDisplay="Top" PageSize="20">

     

    <CommandItemTemplate>

     

    <telerik:RadToolBar ID="rtbarGrid" OnButtonClick="rtbarGrid_ButtonClick" runat="server" Width="100%" CausesValidation="false" Visible="false"

     

    OnClientButtonClicking="rtbarGrid_ClientButtonClicking">

     

    <Items>

     

    <telerik:RadToolBarButton Text="Search Item" CommandName="SearchItem" Visible="true" CausesValidation="false"></telerik:RadToolBarButton>

     

    <telerik:RadToolBarButton Text="Add new" CommandName="InitInsert" Visible="<%# !RadGrid1.MasterTableView.IsItemInserted %>" CausesValidation="false"></telerik:RadToolBarButton>

     

    <telerik:RadToolBarButton Text="Edit Item" CommandName="EditSelected" Visible="<%# RadGrid1.EditIndexes.Count == 0 %>" CausesValidation="false"></telerik:RadToolBarButton>

     

    <telerik:RadToolBarButton Text="Update" CommandName="UpdateEdited" CausesValidation="false" Visible="<%# RadGrid1.EditIndexes.Count > 0 %>"></telerik:RadToolBarButton>

     

    <telerik:RadToolBarButton Text="Cancel editing" CommandName="CancelAll" Visible="<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>" CausesValidation="false"></telerik:RadToolBarButton>

     

    <telerik:RadToolBarButton Text="Add this Item" CommandName="PerformInsert" Visible="<%# RadGrid1.MasterTableView.IsItemInserted %>" CausesValidation="false"></telerik:RadToolBarButton>

     

    <telerik:RadToolBarButton Text="Delete Item" CommandName="DeleteSelected" Visible="true"></telerik:RadToolBarButton>

     

    </Items>

     

    </telerik:RadToolBar>

     

    </CommandItemTemplate>

     

    <RowIndicatorColumn Visible="True"></RowIndicatorColumn>

     

    <ExpandCollapseColumn Visible="True"></ExpandCollapseColumn>

     

    <Columns>

     

    <telerik:GridBoundColumn DataField="ItemCode" Visible="true" HeaderText="Item No" UniqueName="colItemCode"></telerik:GridBoundColumn>

     

    <telerik:GridTemplateColumn HeaderText="Manuf Part No." UniqueName="colU_MCGRP_PN" HeaderStyle-Width="200px" ItemStyle-Width="200px">

     

    <FooterStyle VerticalAlign="Middle" />

     

    <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "U_MCGRP_PN")%></ItemTemplate>

     

    <EditItemTemplate>

     

    <telerik:RadComboBox ID="rcbItem" runat="server" Height="200px" Width="100%" DataTextField="U_MCGRP_PN"

     

    EmptyMessage="Choose a Item" HighlightTemplatedItems="true" DataValueField="ItemCode" DropDownWidth="900px" OffsetX="0"

     

    EnableLoadOnDemand="true" Filter="Contains" CloseDropDownOnBlur="true" AutoPostBack="true"

     

    OnSelectedIndexChanged="rcbItem_SelectedIndexChange" OnItemsRequested="rcbItem_ItemsRequested">

     

    <HeaderTemplate>

     

    <ul>

     

    <li class="cbLItemName">Manuf Part No.</li>

     

    <li class="cbLItemDesc">Description</li>

     

    <li class="cbL2">Brand Name</li>

     

    <li class="cbLShortNumber">Stock</li>

     

    </ul>

     

    </HeaderTemplate>

     

    <ItemTemplate>

     

    <ul>

     

    <li class="cbLItemName"><%# DataBinder.Eval(Container.DataItem, "U_MCGRP_PN")%></li>

     

    <li class="cbLItemDesc">&nbsp;<%# DataBinder.Eval(Container.DataItem, "FrgnName")%></li>

     

    <li class="cbL2">&nbsp;<%# DataBinder.Eval(Container.DataItem, "U_ItmBrndN")%></li>

     

    <li class="cbLShortNumber">&nbsp;<%# (DataBinder.Eval(Container.DataItem, "OnHand").ToString())%></li>

     

    </ul>

     

    </ItemTemplate>

     

    </telerik:RadComboBox>

     

    </EditItemTemplate>

     

    </telerik:GridTemplateColumn>

    <telerik:GridBoundColumn DataField="FrgnName" HeaderText="Description" UniqueName="colDescription"></telerik:GridBoundColumn>

    <telerik:GridBoundColumn DataField="Brand" HeaderText="Brand Name" UniqueName="colU_ItmBrndN" HeaderStyle-Width="120px" ItemStyle-Width="120px"></telerik:GridBoundColumn>

    <telerik:GridNumericColumn DataField="Quantity" HeaderText="Quantity" UniqueName="colQty" DefaultInsertValue="0" DecimalDigits="0"

    HeaderStyle-Width="50px" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Right">

    </telerik:GridNumericColumn>

    </Columns>

    <EditFormSettings>

    <EditColumn FilterControlAltText="Filter EditCommandColumn column">

    </EditColumn> </EditFormSettings> <PagerStyle Mode="NumericPages" PageButtonCount="4" />

     

    </MasterTableView><FilterMenu EnableImageSprites="False"></FilterMenu>
    </telerik:RadGrid>

  2. Eyup
    Admin
    Eyup avatar
    3691 posts

    Posted 05 Jun 2012 Link to this post

    Hi Carlos,

    Thank you for contacting us.

    I have created a sample RadGrid web site using the provided code where I implemented the desired functionality. Please check out the attached application and let me know if you need further assistance.

    Kind regards,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top