Hi all,
i'm a beginner , we work with visual studio 4.0 and we migrate to the new version of infragistics v 15.1
before, on this application we have an ultra web menu , a user click on a item, go to the server , save some information and execute a javascript with scriptmanager.registerstartUpscript ..
that's work fine with NO POST BACK ..
Now, we made the migration and use the web data menu
when the user click on a item on the web data menu we go to the server method but if the flag autopostback item click is set to false the scriptmanager is never executed !
same thing with flag asyn, that's work fine with the flag post back => on but we need to keept no post back ..
Any advise or some solution ?
thanks in advance
christophe
Hello,
Thank you for contacting us.
The new WebDataMenu control is entirely different from the old one, so my suggestion is not to search for direct equivalents for all functionalities. With the new menu, a lot of stuffs can be performed "on the client" and it is not necessary to go to the server. So could you please let me know what exactly you are trying to achieve?
Looking forward to hearing from you.
Hello zdravko kolev,
thanks for your reply
we migrate to the new version of infragistic v 15.1
on a page i have a web data menu as this :
<asp:UpdatePanel ID="upnExport" runat="server" UpdateMode="Always"> <ContentTemplate>
<!-- pdf menu --> <ig:WebDataMenu ID="uwPdfMenu" runat="server" StyleSetPath="/Hris/ig_res" IsContextMenu="true" StyleSetName="Office2010Blue"> <ClientEvents ItemClick="itemClickHandler" /> </ig:WebDataMenu>
</ContentTemplate> </asp:UpdatePanel>
the javascript function :
function itemClickHandler(menuID, itemID) {
var menuInstance = $find('cphMain_' + menuID); // Page_ClientValidate();
//cancel postback if (!Page_IsValid) itemID.set_cancel(true);
}
and code behin there is it what we can do :
// page load
uwPdfMenu.AutoPostBackFlags.ItemClick = Infragistics.Web.UI.AutoPostBackFlag.Async;
//initialize event handler
private void InitializeComponent() { // this.uwPdfMenu.ItemClick += new Infragistics.Web.UI.NavigationControls.DataMenuItemEventHandler(this.uwPdfMenu_MenuItem); }
// call code behin
//protected void uwPdfMenu_MenuItemClicked(object sender, Infragistics.WebUI.UltraWebNavigator.WebMenuItemEventArgs e) private void uwPdfMenu_MenuItem(object sender, Infragistics.Web.UI.NavigationControls.DataMenuItemEventArgs e) { // string lang = "fr"; // //if (!e.Item.DataKey.ToString().Equals("fr", StringComparison.InvariantCultureIgnoreCase)) if(!e.Item.Key.ToString().Equals("fr", StringComparison.InvariantCultureIgnoreCase)) { lang = "en"; } // setPreviewData(lang); ScriptManager.RegisterStartupScript(Page, typeof(Page), "loadPdf", string.Format("window.open('{0}/preview/inPdf.aspx','','resizable=yes,scrollbars=yes,width=900,height=700,Left=' + ((screen.width - 900) / 2) + ',top=' + ((screen.height - 700) / 2));", Request.ApplicationPath), true); }
well, when a user open the menu and click on a item we check if all datas if complete, if yes we pass to code behind on the method : uwPdfMenu_MenuItem
that's work fine but my problem is the scriptManager register starter script IS NEVER executed and i can understand why !
i must to keept this method because the method name : setPrevisousData save all records before to open the document
If i set the Infragistics.Web.UI.AutoPostBackFlag.On
that work BUT i lost all datas that the user must enter => ok i can set view state but we don't like that
thanks for your time
Thank you for the detailed explanation.
This is the correct approach, you should set the AutoPostBackFlag and also to enable the ViewState. Could you please let me know why don't you like that approach. Using of ViewState is common in scenarios like that.
thanks for your reply ..
we don't like to put view state because with the ultrawebMenu all works perfectly ..
we just want to migrate with a short cost ..
i've made an work around with a hide button => click on button and lauch the scriptmanager ..
that's works :)
Last question, i've notice when i test the controls webdatamenu if i select an item and i open the menu again this item is always selected ?
how i can delete this selection ?
thanks for all
Thank you for using our forum.
This is the default selection behavior of the WebDataMenu. A possible solution for you can be to handle ItemSelected client event and clear the selection there:
<script> function WebDataMenu1_ItemSelected(sender, eventArgs) { setTimeout(function myfunction() { ig_controls.WebDataMenu1.get_selectedItem().set_selected(false); }, 0); } </script>
Let me know if I may be of further assistance.
Hello zdravko kolev
thanks for your time that's exactly what i want ..
have a nice day
You too Chris.