This is a migrated thread and some comments may be shown as answers.

Fill out grid cells with radcombobox embedded in same grid.

1 Answer 22 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Carlos
Top achievements
Rank 1
Carlos asked on 31 May 2012, 02:09 PM
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>

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 05 Jun 2012, 03:08 PM
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.
Tags
General Discussions
Asked by
Carlos
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or