I'm using SPGridview in ASPX page.I've added SPMenuField in SPGridView Dynamically.But Context menu is not working when paging happens inside the RadAjaxManager .
1.For the First time context menu is working fine.when i click on paging that context menu is not coming.
Note: if i remove the telerik:RadAjaxManager everthing will work fine.
This is my code .......Can you please let me know !!!!
ASPX Page:
<
cc1:SPGridView ID="spgUsers" runat="server" Width="100%" AutoGenerateColumns="False"
AllowPaging="True" AllowSorting="true" PageSize="10" PagerSettings-Mode="Numeric"
PagerSettings-Position="bottom" PagerSettings-Visible="true" PagerStyle-HorizontalAlign="Center"
RowStyle-Height="30px">
<FooterStyle CssClass="GridHeader" Height="32px" />
<RowStyle CssClass="GridItem" Height="32px" />
<PagerStyle CssClass="GridPaging" />
<AlternatingRowStyle CssClass="GridAltItem" Height="32px" />
</cc1:SPGridView>
Code Behind File:
This is the way i'm adding the SPMenuField in to SPGridView.
SPMenuField mnuFldUserName = new SPMenuField();
strMNUID = System.
Guid.NewGuid().ToString();
mnuFldUserName.MenuTemplateId = strMNUID;
mnuFldUserName.HeaderText =
"User Name";
mnuFldUserName.TextFields =
"UserName";
mnuFldUserName.SortExpression =
"UserName";
mnuFldUserName.TokenNameAndValueFields =
"UID=UserId,Status=Status";
temp =
new MenuTemplate();
temp.ID = strMNUID;
for (int i = 0; i < strPrivilege.Length; i++)
{
switch (strPrivilege[i].ToString())
{
case "101":
MenuItemTemplate mitEditUserInfo = new MenuItemTemplate(this.GetGlobalResourceObject("ActiveDirectoryHome", "mnuEditUserDetails").ToString(), "/_LAYOUTS/ActiveDirectory/Images/EditUserProfile.gif");
mitEditUserInfo.ClientOnClickNavigateUrl =
SPContext.Current.Web.Url + @"/_layouts/ActiveDirectory/Adcreateuser.aspx?pagetype=edituser&ID=%UID%" + "&Source=" + strUrl;
mitEditUserInfo.Title =
this.GetGlobalResourceObject("ActiveDirectoryHome", "mitEditUserInfotitle").ToString();
temp.Controls.Add(mitEditUserInfo);
break;
case "102":
MenuItemTemplate mitViewUserInfo = new MenuItemTemplate(this.GetGlobalResourceObject("ActiveDirectoryHome", "mnuViewUserDetails").ToString(), "/_LAYOUTS/ActiveDirectory/Images/ViewUserProfile.PNG");
mitViewUserInfo.ClientOnClickNavigateUrl =
SPContext.Current.Web.Url + @"/_layouts/ActiveDirectory/Adcreateuser.aspx?PageType=ViewUser&ID=%UID%" + "&Source=" + strUrl;
mitViewUserInfo.Title =
this.GetGlobalResourceObject("ActiveDirectoryHome", "mitViewUserInfotitle").ToString();
temp.Controls.Add(mitViewUserInfo);
break;
}
this.Controls.Add(temp);
spgUsers.Columns.Add(mnuFldUserName);