Hi,
i m trying to migrate from Ultrawebtoolbar to WebDataMenu, while migrating i came across a TBarButton what is it ?
how to replace the below old code with webdatamenu code ?
old code :-
TBarButton tbbtn = (TBarButton)UltraWebToolbar1.Items.FromKey(nameKey);
In Ultratoolbar we had UltraWebToolbar1.ButtonClicked what is the equal method for WebDataMenu ? is it ItemSelected ? if not what is the equivalent method
thanks
Ravi
hi can any one reply for my post.
for TBarButton tbbtn = (TBarButton)UltraWebToolbar1.Items.FromKey(nameKey); code i m replacing as below :
WebDataMenu wdm = new WebDataMenu(); wdm.Items.Add(nameKey);
is the above code correct ? if not pls suggest me what need to be done ?
Thanks
Hello Ravi,
You are correct that the item to use in the WebDataMenu that is equivalent to the ToolbarButton is the DataMenuItem. The equivalent of the code you originally provided:
is the following:
DataMenuItem item = wdm.Items.FindDataMenuItemByKey(nameKey);
In regards to ButtonClicked, you can use the ItemClick event on the WebDataMenu.
For more information about what is available on the WebDataMenu, please see our API documentation. Please let me know if you have any other questions about the WebDataMenu.
Hi jason,
thanks for u r reply, i m getting one more error as below.
Error :- WebDataMenu Selected Item(oItem.Key) is giving "undefined"
i m using WebDataMenu when binding some images to DataMenuItem when i click on DataMenuItem where Key="Add" it is firing below mentioned java script code but oItem.Key is giving undefined. how to get the oItem.Key value in the below javascript code ?
<ig:WebDataMenu ID="WDM" height="22px" itemspacing="0" itemwidthdefault="25px" tabindex="0" runat="server" OnItemClick="WDM_ItemClick" Width="100%"> <AutoPostBackFlags ItemClick="On" /> <GroupSettings Orientation="Horizontal" /> <ClientEvents ItemClick="WDMEditToolbarButtonClicked" /> <ItemSettings CssClass="ItemCssClass" SelectedCssClass="ItemSelectedCSS" HoverCssClass="ItemHoverCSS" /> <Items><ig:DataMenuItem ImageUrl=".new.gif" Key="Add"></ig:DataMenuItem> <ig:DataMenuItem ImageUrl="edit.gif" Key="Edit"></ig:DataMenuItem> <ig:DataMenuItem ImageUrl="copy.gif" Key="Copy"></ig:DataMenuItem> <ig:DataMenuItem ImageUrl="delete.gif" Key="Delete"></ig:DataMenuItem> </Items>
</ig:WebDataMenu>
JavaScript Code:-
function WDMEditToolbarButtonClicked(oToolBar, oItem, oEvent) { if(oItem.Key == "Add")
{ alert(oItem.Key); }
}
ravi
For the Infragistics AJAX controls all of the properties that you see off of the objects make use of getter and setter functions. For your code use:
function WDMEditToolbarButtonClicked(oToolBar, oItem, oEvent) {
var key = oItem.get_key(); if(key == "Add")
{ alert(key); }
Hi Jason,
i tried with replacing my code as shown below
not working:-
below code will give this error. Error:- Object doesn't support property or method 'get_key'
working code:-
function WDMEditToolbarButtonClicked(sender, eventArgs) { var Key = eventArgs.getItem().get_key();if (Key == "Add") { alert(key); }
Root Cause : in the not working code i was using event parameters of ItemClick client-side event that are defining are not available in the new WebDateMenu control's ItemClick event.