This is a migrated thread and some comments may be shown as answers.

[Solved] Context Menu problem in SPGridView

4 Answers 17 Views
RadControls
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
RamPrasad L
Top achievements
Rank 1
RamPrasad L asked on 05 Jan 2010, 11:12 AM
Hi,
 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);

4 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 06 Jan 2010, 02:53 PM
Hi RamPrasad,

Could you please share the RadAjaxManager settings as well?
I assume that the SPGridView is ajaxified. In this case I suggest that you add an ajax setting where the SPGridView updates the SPContextMenu and see if it makes any difference.

Let me know how it goes.

Greetings,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
RamPrasad L
Top achievements
Rank 1
answered on 07 Jan 2010, 05:17 AM

No its Ajaxified.I'm using RadAjaxmanager Settings only.My settings as follows....


<

 

asp:ScriptManager ID="ScriptManager1" runat="server">

 

 

</asp:ScriptManager>

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="spgUsers">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="spgUsers" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

</AjaxSettings>

 

 

</telerik:RadAjaxManager>

///Here My SPGridView code will come..

 

 

<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>

 

0
Iana Tsolova
Telerik team
answered on 07 Jan 2010, 09:08 AM
Hello RamPrasad,

The RadAjaxManager and the GridView declarations seem proper to me and I am not sure what could be causing the unexpected behavior. Therefore I suggest that you try adding the problematic menu to the grid declaratively and see if it works thus. Also, it would be great if you can if the same scenario works when the grid is ajaxified with ASP:UpdatePanel. For that purpose, you can comment the RadAjaxManager and wrap the grid into ASP:UpdatePanel with UpdateMode set to conditional.

Try it out and do let me know of the result.  

Sincerely yours,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
RamPrasad L
Top achievements
Rank 1
answered on 07 Jan 2010, 11:29 AM
I've tried that too.For Ajax also first time only the context menu is working when paging happens Context Menu not working.Now i'm trying with RadGrid Control .Please let me know if you find any solution for that.
Tags
RadControls
Asked by
RamPrasad L
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
RamPrasad L
Top achievements
Rank 1
Share this question
or