Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
560
Enabling/disabling WebDataMenu items on client side breaks submit page
posted

Hi,

during migration to Infragistics 12.2 from Infragistics 10.3 we have encountered really strange behaviour.

This is a sample ASP.Net page

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Content.aspx.cs" Inherits="WebApplication1.Content" %>

<%@ Register Assembly="Infragistics35.Web.v12.2, Version=12.2.20122.2107, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI" tagprefix="ig" %>
<%@ Register Assembly="Infragistics35.Web.v12.2, Version=12.2.20122.2107, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.NavigationControls" tagprefix="ig" %>
<%@ Register assembly="Infragistics35.WebUI.Misc.v12.2, Version=12.2.20122.2107, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.Misc" tagprefix="igmisc" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<style type="text/css">
body,html{
margin: 0px;
padding: 0px;
}
</style>
<script type="text/javascript">
function disable() {
var dataMenu = $IG.WebDataMenu.find("WebDataMenu1");
var buttonEdit = dataMenu.getItems().getItem(1);
buttonEdit.set_enabled(false);
var buttonRemove = dataMenu.getItems().getItem(2);
buttonRemove.set_enabled(false);
}
function enable() {
var dataMenu = $IG.WebDataMenu.find("WebDataMenu1");
var buttonEdit = dataMenu.getItems().getItem(1);
buttonEdit.set_enabled(true);
var buttonRemove = dataMenu.getItems().getItem(2);
buttonRemove.set_enabled(true);
}
</script>
</head>
<body bgcolor="#FFFFFF">
<form id="form1" runat="server">
<div>
<ig:WebScriptManager ID="WebScriptManager1" runat="server">
</ig:WebScriptManager>
</div>
<ig:WebDataMenu ID="WebDataMenu1" runat="server"
onitemclick="WebDataMenu1_ItemClick" ActivateOnHover="False">
<Items>
<ig:DataMenuItem Key="Add" Text="Add" ToolTip="Add" Value="Add">
</ig:DataMenuItem>
<ig:DataMenuItem Key="Edit" Text="Edit" ToolTip="Edit" Value="Edit">
</ig:DataMenuItem>
<ig:DataMenuItem Key="Remove" Text="Remove" ToolTip="Remove" Value="Remove">
</ig:DataMenuItem>
<ig:DataMenuItem Key="Ok" Text="Ok" ToolTip="Ok" Value="Ok">
</ig:DataMenuItem>
</Items>
<GroupSettings Orientation="Horizontal" />
</ig:WebDataMenu>
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<br />
<input id="Button1" type="button" value="ENABLE" onclick="enable();" />
<br />
<input id="Button2" type="button" value="DISABLE" onclick="disable();" />
</form>
</body>
</html>

and this is code behind

using System;

namespace WebApplication1
{
public partial class Content : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


}

protected void WebDataMenu1_ItemClick(object sender, Infragistics.Web.UI.NavigationControls.DataMenuItemEventArgs e)
{
Label1.Text = e.Item.Key;
}
}
}

When user clicks on any item on WebDataMenu, page is submitted and in label we output the Key of the button which was clicked. When we execute javascript code which either enables or disables WebDataMenu items, when we click on one of the items which changed state, page is not submitted but it's redirected to root directory, for example url is http://localhost/infragistics/Content.aspx and after clicking item which state was changed we are redirected to http://localhost/infragistics.

Can you please explain me what is happening here. We have multiple scenarios when items are enabled/disabled on client side and on server side in regards to permissions and roles and what is selected on page.

Thanks.