The replacement for the retiring ultrawebtoolbar is the webdatamenu but I can't find any samples or examples or any information about how to achieve this. I have a very simple toolbar with two dropdownlists and a button. Do you have any suggestions as to how I can create a menu with these controls embedded and be able to access the controls in the code behind. I tried creating templates but then couldn't see them in the code behind. I don't know whether the templates need to be created using a class (as in the webdatagrid templated columns) or whether to access the control using findcontrol (as in the webexplorer). Is there any migration documentation to indicate how this can be achieved?
Thanks
Andy
BTW I love the term 'sunset policy'...
Hello jcad,
The attached sample (WebDataMenu.zip) demonstrates how to set up a WebDataMenu with two dropdown lists and a button. Using a template means that each instance of the dropdowns are generated dynamically, thus their Client IDs are generated as the page loads. This is why you couldn't see them in the code behind. The only way to find them is to search through the controls and differentiate them by their client IDs, which is demonstrated in Default.aspx.cs.
I had to cut out the ig_res folder to reduce the filesize low enough for attaching. You can add those to the sample on your end to view everything properly.
If you have any further questions, please let me know.
My existing application creates the controls in code and add them to the toolbar so I want to create the controls and add them to the templates:
chkShowDescendantRecords = New CheckBox With chkShowDescendantRecords .AutoPostBack = True .CssClass = CssClass.ToolBarCheckBox .ID = "chkShowDescendantRecords" .Text = "Show Descendant Records" .LabelAttributes.Add("hideFocus", "true") .Checked = GetSessionBoolean(SessionVariable.ExplorerShowDescendants) End With WebDataMenu1.Templates.Item(0).Controls.Add(chkShowDescendantRecords)
The code runs ok but the checkbox control does not appear in the webdatamenu.
Is there away to get this to work?
Hello Andy,
For your first issue with retreiving the object, $find is probably returning null because the WebDataMenu isn't instantiated on the client when your function is called. AJAX controls are initialized after the page is loaded, so you would need to wait until later in the page's life-cycle to obtain it.
If possible for you, I recommend using the WebDataMenu's client side Initialize event to call your function and using $find("<%= WebDataMenu1.ClientID %>") should return the correct object.
As for adding the controls to the template, that code looks fine. I tried the same code, and was able to reproduce the issue. I'll need to look into it a little bit further and should have an answer for you by the end of Friday.
If you have any further questions or concerns, please let me know and I'll be glad to help.
Hi Andy,
The developer says you can create your own template and add controls to it as you desire with the following code:
If you have any other questions about this matter, please feel free to ask.
I finally got my answer here: http://forums.infragistics.com/forums/p/69142/350694.aspx#350694
I also am having trouble trying to use WebDataMenu as a toolbar. I just want a simple toolbar with ONLY image buttons (with no text on the buttons). Anyone have a sample of how to do this? It was possible with the old WebToolbar. This should be simple, correct? What am I doing wrong? Please help!!!
I can not even find an example of how to do this on the on the Samples page (http://samples.infragistics.com/aspnet/Samples/WebDataMenu/Display/VerticalMenu/Default.aspx?cn=data-menu&sid=1b19ba76-eb5b-41e7-b757-716fdb9fbc35).
Is this the same issue as IntegraXP, that is the dropdownlist cannot get focus? This is a critical issue for us now as the toolbars are used in many pages and there is no alternative but to use the webdatamenu..
Sorry lost some fomatting on last post:
I define the dropdownlist controls in the aspx.
<ig:WebDataMenu ID="WebDataMenu1" runat="server" StyleSetName="Claymation" Width="100%" EnableScrolling="False"> <GroupSettings Orientation="Horizontal" /> <Items> <ig:DataMenuItem TemplateId="tmpContact" Text="Root Item"> </ig:DataMenuItem> <ig:DataMenuItem Key="Refresh" ImageUrl="./images/webtoolbar/NewRisk.gif" Text="Refresh"> </ig:DataMenuItem> </Items> <Templates> <ig:ItemTemplate ID="itmpContact" runat="server" TemplateID="tmpContact"> <Template> <asp:DropDownList ID="ddlContact" runat="server" CssClass="dropdownlist" DataTextField="Name" DataValueField="Code" Width="400px"> </asp:DropDownList> </Template> </ig:ItemTemplate> </Templates> </ig:WebDataMenu>
I use code from your example above to get the reference to the templated control. I have tried this in Page_Load and Page_InitComplete. The reference is set and I add a handler to the control.
ddlContact = CType(GetTemplatedControl(WebDataMenu1, "ddlContact"), DropDownList) AddHandler ddlContact.SelectedIndexChanged, AddressOf ddlContact_SelectedIndexChanged
But when I click on the dropdownlist it drops down and immediately disappears. The server event WebDataMenu1_ItemClick is fired and it never fires the ddlContact_SelectedIndexChanged handler.
Any idea why this is happening? If I switch off the autopostback on the menu it still happens.Any examples of how to implement dropdownlists as templates inside a webdatamenu?
But when I click on the dropdownlist it drops down and immediately disappears. The server event
WebDataMenu1_ItemClick
is fired and it never fires the ddlContact_SelectedIndexChanged handler.
Any idea why this is happening? If I switch off the autopostback on the menu it still happens.
Any examples of how to implement dropdownlists as templates inside a webdatamenu?