Hello,
I have a simple WebDataMenu and for some action I want a postback and other no postback
I use the NavigateURL property to define the new page
But in all cases, I alwaws have a postback
I don't want to disable postback for all item ans manage by myself the postback
Is there a way to do want I want ?
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
DataMenuItem rootItem = WebDataMenu1.Items.Add("Main menu", "Main");
DataMenuItem item1 = new DataMenuItem();
item1.Text =
"NavigateUrl";
item1.Value =
"ValSub1";
item1.NavigateUrl =
"http://www.microsoft.com";
item1.Target =
"blank";
rootItem.Items.Add(item1);
DataMenuItem item2 = new DataMenuItem();
item2.Text =
"PostBack";
item2.Value =
"ValSub2";
item2.Key =
rootItem.Items.Add(item2);
}
protected void ServerAction(object sender, DataMenuItemEventArgs e)
and aspx
function NoPostBack(sender, e) {
var itemMenu = e.getItem();
alert(itemMenu.get_valueString());
if (itemMenu.get_valueString() == '')
e.set_cancel(
true);
<ig:WebDataMenu ID="WebDataMenu1" runat="server" Height="39px" Width="132px" OnItemClick="ServerAction">
<AutoPostBackFlags ItemClick="On" ItemSelected="Off" />
<GroupSettings Orientation="Horizontal" />
<ClientEvents ItemClick="NoPostBack" />
</ig:WebDataMenu>
Thank you very much for your help
Romain
if I use e.set_cancel(true) in the javascript for my item2 with no postback, the navigateurl is never called
I was able to see the behavior you described. I have attached the issue with our developers in our tracking system, with an issue ID of # 139640. This development issue will be assigned to a developer to research for a fix, workaround, or other resolution. If some other resolution is reached, I will update this forum thread with more details on this.
I hope this helps.