<
telerik:RadGrid
ID="referencesForCaseGrid"
Skin="MainGrid"
EnableEmbeddedSkins="false"
ShowStatusBar="false"
runat="server"
AutoGenerateColumns="False"
AllowSorting="True"
AllowMultiRowSelection="False"
GridLines="None"
Style="border: 0; outline: none;"
HeaderStyle-Height="25"
AllowAutomaticInserts="false"
AllowAutomaticDeletes="false"
AllowAutomaticUpdates="false"
EnableViewState="false">
<ItemStyle Wrap="true" VerticalAlign="Top" />
<AlternatingItemStyle Wrap="true" VerticalAlign="Top" />
<ClientSettings>
<Selecting AllowRowSelect="false" />
<Scrolling AllowScroll="false" />
</ClientSettings>
<MasterTableView
AllowPaging="true"
PageSize="10"
PagerStyle-AlwaysVisible="true"
AllowMultiColumnSorting="True"
EnableColumnsViewState="false"
AllowCustomSorting="false"
TableLayout="Fixed"
EditMode="InPlace">
<Columns>
<telerik:GridDropDownColumn
UniqueName="RelationStatus"
HeaderText="Relation Status"
DataField="RelationStatusTypeID"
ListDataMember="RelationStatusTypes"
ListTextField="Title"
ListValueField="ID"
SortExpression="Title"
DropDownControlType="RadComboBox"
HeaderStyle-Width="150px" />
<telerik:GridEditCommandColumn />
</Columns>
</MasterTableView>
</telerik:RadGrid>
So when i press edit, I can choose a value in the dropdown, press update and the update command -event fires.
void
caseGrid_UpdateCommand(object source, GridCommandEventArgs e)
{
if(e.CommandName.Equals("Update") && e.Item is GridEditableItem)
{
var item = e.Item as GridDataItem;
int oldRelationTypeID = int.Parse(item.GetDataKeyValue("RelationStatusTypeID").ToString());
RadComboBox ddl = item["RelationStatus"].Controls[0] as RadComboBox;
int newRelationTypeID = int.Parse(ddl.SelectedValue);
GridEditableItem item2 = e.Item as GridEditableItem;
GridEditManager man = item2.EditManager;
RadComboBox operCombo = (man.GetColumnEditor("RelationStatus") as GridDropDownListColumnEditor).ComboBoxControl;
string operId = operCombo.SelectedValue;
// also returns preselected value
}
}
The problem here is that the value I get is the preselected one, not the one selected in the dropdown.
runat="server" AutoGenerateColumns="False" DataSourceID="odsInvLines"
GridLines="None" OnItemDataBound="gridInvLines_
<ClientSettings >
<ClientEvents OnKeyPress="disableEnterKey" OnCommand="OnGridCommand" OnPopUpShowing="PopUpShowing" />
</ClientSettings>
<MasterTableView DataKeyNames="LINE_NUMBER" DataSourceID="odsInvLines" EditMode="PopUp" InsertItemDisplay="Top" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" CommandItemDisplay="Top" CommandItemSettings-
<Columns>
<telerik:GridEditCommandColumn ButtonType="LinkButton" InsertText="Save" UniqueName="EditButton">
<ItemStyle HorizontalAlign="Center" Width="30px" />
</telerik:GridEditCommandColum
</Columns>
<EditFormSettings EditColumn-UpdateText="Save" EditColumn-InsertText="Save" CaptionFormatString="Invoice Line Information" ColumnNumber="2">
<FormTableItemStyle Wrap="False" Width="100%"></FormTableItemSt
<FormCaptionStyle CssClass="EditFormHeader" Width="100%"></FormCaptionStyl
<FormMainTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="3" BackColor="White"
Width="100%" />
<FormTableStyle CellSpacing="0" CellPadding="2" CssClass="module" Height="110px"
BackColor="White" />
<FormTableAlternatingItemStyle Wrap="False"></FormTableAltern
<PopUpSettings Modal="true" Width="600" />
</EditFormSettings>
</MasterTableView>
<ValidationSettings CommandsToValidate="
function
OnGridCommand(sender, eventArgs){
if(eventArgs.get_commandName() == "Edit" || eventArgs.get_commandName() == "InitInsert" )
{
if (!Page_ClientValidate()) return false;
}
}
//server event
protected void gridInvLines_ItemCommand(objec
{
switch (e.CommandName)
{
case RadGrid.InitInsertCommandName:
e.Canceled =
true;//this is for the Calendar Date control
System.Collections.
if(radBillPeriodStartDate.
newValues[
newValues[
e.Item.OwnerTableView.
default:
break;
}
}
<httpHandlers> <add path="Telerik.Web.UI.WebResource.axd"type="Telerik.Web.UI.WebResourceSession" verb="*" validate="false" /></httpHandlers> <handlers> <add name="Telerik_Web_UI_WebResource_axd" verb="*"preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd"type="Telerik.Web.UI.WebResourceSession" /></handlers>

| <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" |
| GridLines="None" onitemdatabound="RadGrid1_ItemDataBound"> |
| <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource1"> |
| <Columns> |
| <telerik:GridTemplateColumn> |
| <FooterTemplate> |
| <telerik:RadComboBox ID="RadComboBox1" runat="server"> |
| <ItemTemplate> |
| <telerik:RadGrid ID="RadGrid2" runat="server"> |
| </telerik:RadGrid> |
| </ItemTemplate> |
| </telerik:RadComboBox> |
| </FooterTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" |
| ConnectionString="<%$ ConnectionStrings:XConnectionString %>" |
| SelectCommand="SELECT [Name] FROM [Projects]"></asp:SqlDataSource> |
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) | |
| { | |
| if (e.Item is GridFooterItem) | |
| { | |
| GridFooterItem footer = (GridFooterItem)e.Item; | |
| RadComboBox combo = ((RadComboBox)footer.FindControl("RadComboBox1")); | |
RadGrid grid = ((RadGrid)combo.Items[0].FindControl("RadGrid2")); //result is null
|
|
| string r = "fF"; | |
| } | |
| } |