Hello
I am using a RadComboBox inside a RadGrid.
The RadComboBox is populated by a web service.
The radgrid is being used as a form, where the user can input data to the grid (one row at a time) then click on "insert".
When the user clicks "insert" I need to get access to the value chosen by the user in the RadComboBox.
Below I have put my aspx and then my code-behind for the OnInsert event.
How can I finish my OnInsert event so that I have access to the value chosen by the user in the RadComboBox?
I am using a RadComboBox inside a RadGrid.
The RadComboBox is populated by a web service.
The radgrid is being used as a form, where the user can input data to the grid (one row at a time) then click on "insert".
When the user clicks "insert" I need to get access to the value chosen by the user in the RadComboBox.
Below I have put my aspx and then my code-behind for the OnInsert event.
How can I finish my OnInsert event so that I have access to the value chosen by the user in the RadComboBox?
<telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" AllowPaging="true" OnNeedDataSource="RadGrid1_NeedDataSource" AutoGenerateEditColumn="True" OnInsertCommand="RadGrid1_OnInsert" OnItemCreated="RadGrid1_ItemCreated" Width="99%" OnPreRender="RadGrid1_PreRender"> <MasterTableView runat="server" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage" EditMode="InPlace" Width="100%" TableLayout="Auto"> <Columns> <telerik:GridTemplateColumn UniqueName="UserCol" HeaderText="proto user" DataField="UserID"> <EditItemTemplate> <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="false" CausesValidation="true" Width="240" MaxHeight="200px" OnItemsRequested="ddEmployee_ItemsRequested" AllowCustomText="true" EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true" MarkFirstMatch="false" > </telerik:RadComboBox> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="FromFloor" HeaderText="From Floor" UniqueName="FFCol" ></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="FromStation" HeaderText="From Station" UniqueName="FSCol" ></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ToFloor" HeaderText="To Floor" UniqueName="TFCol" ></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ToStation" HeaderText="To Station" UniqueName="TSCol" ></telerik:GridBoundColumn> <telerik:GridDateTimeColumn DataField="DateToRelocate" HeaderText="Date To Relocate" UniqueName="DateCol" ></telerik:GridDateTimeColumn> </Columns> </MasterTableView> </telerik:RadGrid>
protected void RadGrid1_OnInsert(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
GridEditManager editMan = editedItem.EditManager;
foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
{
if (column is IGridEditableColumn)
{
IGridEditableColumn editableCol = (column as IGridEditableColumn);
if (editableCol.IsEditable)
{
IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
string editorText = "unknown";
object editorValue = null;
if (editor is GridTemplateColumnEditor)
{
}
if (editor is GridTextColumnEditor)
{
editorText = (editor as GridTextColumnEditor).Text;
editorValue = (editor as GridTextColumnEditor).Text;
}
}
}
}
}