Here is my grid:
<telerik:RadGrid ID="gvWebUsers" runat="server"
OnNeedDataSource="gvWebUsers_NeedDataSource"
OnItemCreated="gvWebUsers_ItemCreated"
Skin="Gray"
AutoGenerateColumns="false"
OnItemDataBound="gvWebUsers_ItemDataBound"
AllowAutomaticUpdates="true"
AllowPaging="true"
CssClass="SettingsGrid"
Width="99.7%">
<ClientSettings Resizing-AllowColumnResize="true" Resizing-ClipCellContentOnResize="true" />
<MasterTableView DataKeyNames="UserID" PageSize="15" EditMode="InPlace" >
<PagerStyle Mode="NextPrevAndNumeric" />
<Columns>
<telerik:GridBoundColumn DataField="EmailAddress" HeaderText="<%$ Resources:English,Settings_MobilityUsers_Email %>"
UniqueName="EmailAddress" ReadOnly="True" />
<telerik:GridBoundColumn DataField="FirstName" HeaderText="<%$ Resources:English,Settings_MobilityUsers_FirstName %>"
UniqueName="FirstName" ReadOnly="True" />
<telerik:GridBoundColumn DataField="LastName" HeaderText="<%$ Resources:English,Settings_MobilityUsers_LastName %>"
UniqueName="LastName" ReadOnly="True" />
<telerik:GridBoundColumn DataField="IsDomainUser" HeaderText="<%$ Resources:English,Settings_MobilityUsers_IsDomainUser %>"
UniqueName="IsDomainUser" ReadOnly="True" />
<telerik:GridBoundColumn DataField="IsVerified" HeaderText="<%$ Resources:English,Settings_MobilityUsers_IsVerified %>"
UniqueName="IsVerified" ReadOnly="True"/>
<telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="BlockButton" />
<telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="ChangePassButton" />
<telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="AllowUploadButton" />
<telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="UnlockButton" />
<telerik:GridTemplateColumn HeaderText="Category" ItemStyle-Width="240px">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "IsUploadAllowed")%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox runat="server" ID="RadComboBox2" skin="Gray">
</telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn FooterText="EditCommand footer" UniqueName="EditCommandColumn"
HeaderText="Edit" HeaderStyle-Width="100px" UpdateText="Update">
</telerik:GridEditCommandColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
I try to bind data from server side as suggested in your posts:
protected void gvWebUsers_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem editItem = (GridEditableItem)e.Item;
RadComboBox combo = (RadComboBox)editItem.FindControl("RadComboBox2");
combo.DataSource = GetUploadStatus();
combo.DataTextField = "Key";
combo.DataValueField = "Value";
combo.DataBind();
}
}
But it never enters into the "if" statement (there is no GridEditableItem)
what am I doing wrong??
<telerik:RadGrid ID="gvWebUsers" runat="server"
OnNeedDataSource="gvWebUsers_NeedDataSource"
OnItemCreated="gvWebUsers_ItemCreated"
Skin="Gray"
AutoGenerateColumns="false"
OnItemDataBound="gvWebUsers_ItemDataBound"
AllowAutomaticUpdates="true"
AllowPaging="true"
CssClass="SettingsGrid"
Width="99.7%">
<ClientSettings Resizing-AllowColumnResize="true" Resizing-ClipCellContentOnResize="true" />
<MasterTableView DataKeyNames="UserID" PageSize="15" EditMode="InPlace" >
<PagerStyle Mode="NextPrevAndNumeric" />
<Columns>
<telerik:GridBoundColumn DataField="EmailAddress" HeaderText="<%$ Resources:English,Settings_MobilityUsers_Email %>"
UniqueName="EmailAddress" ReadOnly="True" />
<telerik:GridBoundColumn DataField="FirstName" HeaderText="<%$ Resources:English,Settings_MobilityUsers_FirstName %>"
UniqueName="FirstName" ReadOnly="True" />
<telerik:GridBoundColumn DataField="LastName" HeaderText="<%$ Resources:English,Settings_MobilityUsers_LastName %>"
UniqueName="LastName" ReadOnly="True" />
<telerik:GridBoundColumn DataField="IsDomainUser" HeaderText="<%$ Resources:English,Settings_MobilityUsers_IsDomainUser %>"
UniqueName="IsDomainUser" ReadOnly="True" />
<telerik:GridBoundColumn DataField="IsVerified" HeaderText="<%$ Resources:English,Settings_MobilityUsers_IsVerified %>"
UniqueName="IsVerified" ReadOnly="True"/>
<telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="BlockButton" />
<telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="ChangePassButton" />
<telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="AllowUploadButton" />
<telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="UnlockButton" />
<telerik:GridTemplateColumn HeaderText="Category" ItemStyle-Width="240px">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "IsUploadAllowed")%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox runat="server" ID="RadComboBox2" skin="Gray">
</telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn FooterText="EditCommand footer" UniqueName="EditCommandColumn"
HeaderText="Edit" HeaderStyle-Width="100px" UpdateText="Update">
</telerik:GridEditCommandColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
I try to bind data from server side as suggested in your posts:
protected void gvWebUsers_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem editItem = (GridEditableItem)e.Item;
RadComboBox combo = (RadComboBox)editItem.FindControl("RadComboBox2");
combo.DataSource = GetUploadStatus();
combo.DataTextField = "Key";
combo.DataValueField = "Value";
combo.DataBind();
}
}
But it never enters into the "if" statement (there is no GridEditableItem)
what am I doing wrong??