This was working just fine until I decided to move the accordion onto the main page instead of having it on the user control.
The GridEditCommandColumn is not firing any events, even the NeedDataSource event.
The grid appears in a ModalPopUp, which worked fine until I moved the accordion to the main page.
I forced the PopUp to stay visible to check the grid and it is not re-binding, and not hitting any events when the GridEditCommandColumn is clicked.
Here is the main aspx page:
<%@ Register src="../../Common/Controls/SiteAdmin/ServiceType/ucServiceTypes.ascx" tagname="ucServiceTypes" tagprefix="uc1" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"head"
runat
=
"Server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
runat
=
"Server"
>
<
asp:UpdatePanel
ID
=
"UpdatePanel1"
runat
=
"server"
>
<
ContentTemplate
>
<
ajax:Accordion
ID
=
"Accordion1"
runat
=
"server"
HeaderCssClass
=
"accordionHeader"
HeaderSelectedCssClass
=
"accordionHeaderSelected"
ContentCssClass
=
"accordionContent"
SelectedIndex
=
"-1"
FadeTransitions
=
"true"
SuppressHeaderPostbacks
=
"true"
TransitionDuration
=
"250"
FramesPerSecond
=
"40"
RequireOpenedPane
=
"false"
AutoSize
=
"None"
Width
=
"100%"
>
</
ajax:Accordion
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
</
asp:Content
>
The the code behind for the main aspx page:
protected void Page_Load(object sender, System.EventArgs e)
{
LoadUserControls();
}
private void LoadUserControls()
{
string path = "~/Common/Controls/SiteAdmin/ServiceType/ucServiceTypes.ascx";
Common_Controls_SiteAdmin_ServiceType_ucServiceTypes uc;
DataTable dt = GetServiceTypes();
for (int i = 0; i < dt.Rows.Count; i++)
{
uc = LoadControl(path) as Common_Controls_SiteAdmin_ServiceType_ucServiceTypes;
uc.ID = "uc" + dt.Rows[i]["Name"].ToString();
uc.ServiceTypeID.Value = dt.Rows[i]["ServiceTypeID"].ToString();
Literal lit = new Literal();
AccordionPane pane = new AccordionPane();
pane.ID = "pane" + i.ToString();
lit = new Literal();
lit.Text = dt.Rows[i]["Name"].ToString();
pane.HeaderContainer.Controls.Add(lit);
pane.ContentContainer.Controls.Add(uc);
Accordion1.Panes.Add(pane);
}
}
Now for the user control:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucServiceTypes.ascx.cs" Inherits="Common_Controls_SiteAdmin_ServiceType_ucServiceTypes" %>
<
asp:HiddenField
ID
=
"hdnServiceTypeID"
runat
=
"server"
/>
<
asp:HiddenField
ID
=
"hdnServiceDefID"
runat
=
"server"
/>
<asp:Panel ID="pnlView" runat="server" Style="display: none;" CssClass="modalPopUpPanel">
<div style="height: 500px; overflow: auto;">
<asp:HiddenField ID="hdnViewPopUp" runat="server" />
<h3 style="text-align: center;" id="header">
<asp:Label ID="lblServiceDefName" runat="server"></asp:Label></h3>
<table style="width: 100%">
<tr>
<td style="text-align: left">
<telerik:RadGrid ID="rgServiceOptionDefs" runat="server" AutoGenerateColumns="False"
ResolvedRenderMode="Classic" AllowAutomaticUpdates="false" AllowAutomaticInserts="false"
OnItemCommand="rgServiceOptionDefs_ItemCommand" OnItemCreated="rgServiceOptionDefs_ItemCreated"
OnNeedDataSource="rgServiceOptionDefs_NeedDataSource" OnItemDataBound="rgServiceOptionDefs_ItemDataBound"
OnEditCommand="rgServiceOptionDefs_EditCommand" OnPreRender="rgServiceOptionDefs_PreRender"
OnUpdateCommand="rgServiceOptionDefs_UpdateCommand">
<MasterTableView DataKeyNames="ServiceOptionDefID" EditMode="InPlace" CommandItemDisplay="Top">
<Columns>
<telerik:GridEditCommandColumn />
<telerik:GridTemplateColumn HeaderText="Name" UniqueName="Name">
<ItemTemplate>
<asp:Label ID="lblName" runat="server" Text='<%#DataBinder.Eval(Container, "DataItem.Name")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtName" runat="server" Text='<%#DataBinder.Eval(Container, "DataItem.Name")%>'></asp:TextBox>
</EditItemTemplate>
<ItemStyle VerticalAlign="Top" HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Type" UniqueName="Type">
<ItemTemplate>
<asp:Label ID="lblType" runat="server" Text='<%#DataBinder.Eval(Container, "DataItem.InputType")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadListBox ID="ddlType" runat="server"></telerik:RadListBox>
</EditItemTemplate>
<ItemStyle VerticalAlign="Top" HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</td>
</tr>
</table>
<p style="text-align: center;">
<asp:Button ID="btnCloseView" CssClass="Button" runat="server" Text="Close" CausesValidation="false" />
</p>
</div>
</asp:Panel>
<ajax:ModalPopupExtender ID="mpeView" runat="server" TargetControlID="hdnViewPopUp" PopupControlID="pnlView"
CancelControlID="btnCloseView" BackgroundCssClass="backgroundColor" DropShadow="true"
PopupDragHandleControlID="header">
</ajax:ModalPopupExtender>
And
protected void rgServiceOptionDefs_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
if (!string.IsNullOrEmpty(hdnServiceDefID.Value))
{
int ServiceDefID = int.Parse(hdnServiceDefID.Value);
DataTable dt = GetServiceOptionDefs(ServiceDefID);
rgServiceOptionDefs.DataSource = dt;
mpeView.Show();
}
}
protected void rgServiceOptionDefs_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
mpeView.Show();
}
else if (e.Item is GridDataItem)
{
GridDataItem dataItem = e.Item as GridDataItem;
mpeView.Show();
}
}
protected void rgServiceOptionDefs_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem && !e.Item.IsInEditMode)
{
}
else if ((e.Item is GridDataItem || e.Item is GridEditableItem) && e.Item.IsInEditMode)
{
//mpeView.Show();
}
if (e.Item is GridEditFormInsertItem || e.Item is GridDataInsertItem)
{
// insert item
}
}
protected void rgServiceOptionDefs_ItemCommand(object sender, GridCommandEventArgs e)
{
mpeView.Show();
}
protected void rgServiceOptionDefs_UpdateCommand(object sender, GridCommandEventArgs e)
{
GridEditableItem item = e.Item as GridEditableItem;
mpeView.Show();
}
protected void rgServiceOptionDefs_EditCommand(object sender, GridCommandEventArgs e)
{
mpeView.Show();
}
protected void rgServiceOptionDefs_PreRender(object sender, EventArgs e)
{
//if (!string.IsNullOrEmpty(hdnServiceDefID.Value))
// mpeView.Show();
}
If anyone needs more information, I will provide it.
But I am at an end here trying to find out why this is happening.
And as can be seen, I've tried a few events.
Thanks.