Hello
I have a RadGrid with one Group. The data is seperated by the groups in a proper way.
So from this point everything is ok.
Data should be added by an edit form (modal popup).
Now I try to display the edit form, but it's just appearing if I press "Add new record".
Pressing "Edit" in a row does not show the edit form.
If remove the grouping of the RadGrid, the edit form appears as expected!
What's the reason for this behaviour?
Here is my code:
I have a RadGrid with one Group. The data is seperated by the groups in a proper way.
So from this point everything is ok.
Data should be added by an edit form (modal popup).
Now I try to display the edit form, but it's just appearing if I press "Add new record".
Pressing "Edit" in a row does not show the edit form.
If remove the grouping of the RadGrid, the edit form appears as expected!
What's the reason for this behaviour?
Here is my code:
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"> |
</asp:ScriptManagerProxy> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="gridMain"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="gridMain" LoadingPanelID="RadAjaxLoadingPanel1" /> |
<telerik:AjaxUpdatedControl ControlID="imgSearch" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="imgSearch"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="gridMain" LoadingPanelID="RadAjaxLoadingPanel1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackgroundPosition="Center" |
Skin="Vista" /> |
<telerik:RadGrid runat="server" ID="gridMain" Width="50%" Style="margin-left: auto; |
margin-right: auto; margin-top: 5px"> |
<ClientSettings> |
<Scrolling AllowScroll="true" UseStaticHeaders="true" /> |
</ClientSettings> |
<GroupingSettings /> |
<MasterTableView AutoGenerateColumns="false" CommandItemDisplay="Top" AllowPaging="true" |
DataKeyNames="BMID" GroupsDefaultExpanded="false" PageSize="100" EditMode="PopUp" GroupLoadMode="Server"> |
<GroupByExpressions> |
<telerik:GridGroupByExpression> |
<GroupByFields> |
<telerik:GridGroupByField FieldName="BMITEM" FieldAlias="Item" /> |
</GroupByFields> |
<SelectFields> |
<telerik:GridGroupByField FieldName="BMITEM" FieldAlias="Item" /> |
</SelectFields> |
</telerik:GridGroupByExpression> |
</GroupByExpressions> |
<Columns> |
<telerik:GridEditCommandColumn> |
</telerik:GridEditCommandColumn> |
<telerik:GridBoundColumn HeaderText="Status" DataField="BMSTAT"> |
<HeaderStyle Width="25px" /> |
<ItemStyle Width="25px" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn HeaderText="Seq." DataField="BMSEQN"> |
<HeaderStyle Width="25px" /> |
<ItemStyle Width="25px" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn HeaderText="Child item" DataField="BMCHLD"> |
<HeaderStyle Width="150px" /> |
<ItemStyle Width="150px" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn HeaderText="Description"> |
<HeaderStyle Width="150px" /> |
<ItemStyle Width="150px" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn HeaderText="Quantity" DataField="BMQTY"> |
<HeaderStyle Width="25px" /> |
<ItemStyle Width="25px" /> |
</telerik:GridBoundColumn> |
</Columns> |
<EditFormSettings EditFormType="Template" InsertCaption="Add new BOM entry" CaptionFormatString="Edit item {0}" |
CaptionDataField="BMID"> |
<PopUpSettings Modal="true" /> |
<FormTemplate> |
<table> |
<tr> |
<td> |
Status |
</td> |
<td class="cellWithTextBox"> |
<asp:DropDownList ID="ddlStatus" runat="server"> |
<asp:ListItem Value="A">Active</asp:ListItem> |
<asp:ListItem Value="D">Disabled</asp:ListItem> |
<asp:ListItem Value="Z">Deleted</asp:ListItem> |
</asp:DropDownList> |
</td> |
</tr> |
<tr> |
<td align="center" colspan="4"> |
<asp:Button ID="btnUpdate" Text='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "Insert" : "Update" %>' |
runat="server" CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "PerformInsert" : "Update" %>'> |
</asp:Button> |
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" |
CommandName="Cancel" /> |
</td> |
</tr> |
</table> |
</FormTemplate> |
</EditFormSettings> |
</MasterTableView> |
</telerik:RadGrid> |
protected void gridMain_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
{ |
LJITDataContext db = new LJITDataContext(); |
IQueryable<LJT_BOM> parts; |
var conditions = PredicateBuilder.True<LJT_BOM>(); |
int startRowIndex = this.gridMain.CurrentPageIndex * this.gridMain.PageSize; |
int maximumRows = this.gridMain.PageSize; |
conditions = conditions.And(p => p.BMITEM.Contains(this.txtFindName.Text)); |
conditions = conditions.And(p => p.BMCHLD.Contains(this.txtFindChild.Text.Trim())); |
parts = db.BOM.Where(conditions).OrderBy(o => o.BMITEM).ThenBy(o => o.BMSEQN); |
this.gridMain.VirtualItemCount = parts.Count(); |
var alles = parts.Skip(startRowIndex).Take(maximumRows); |
this.gridMain.DataSource = parts; |
} |