I am constructing an ASP.NET Menu using an asp:XmlDataSource and setting the Data property and binding the Menu. Everything works well until I have to change the menu. For instance when I remove a menu item from the xml and set the Data to a new xml string and rebind the menu. The item is missing from the datasource but still shows up in the menu. I double check to make sure it is not a refresh problem by doing a Menu.FindItem with the path to the item , which still shows up in the menu. I have even opened the page in another bowser and the item still shows up, so it must be a server issue.
Is there some chaching on the server that needs to be reset or what am I missing?
I will solve my own issue.
The thread at: http://forums.asp.net/t/1239541.aspx/1/10 showed that the xmldatasource has the EnableCaching set to true by default, so even though I was changing the Data property the changes were never making it to the menu.
Related
I have an Xtra Tab Control which contains 6 tab pages. On each of these tab pages lives a User Control which contains a Check Edit on a Binding Navigator that I want to default to checked when creating the form as shown below (worth noting that I am using a library for the Binding Navigator and this code cannot be changed):
To do this I thought I'd be fine putting the code in the Initialise method of the User Control so when creating the User Control for each of these tabs I'd be able to set the EditValue to True but unfortunately even when assigning the EditValue to True the EditValue just remains as Nothing (Indeterminate)
I've managed to get the check edit on the first User Control to set by default by using the UserControl_Loaded event, however, for the other 5 tabs the value is not checked as the Loaded event hasn't fired for these yet until the tab is selected.
Any help is appreciated.
Loop through the tabpages to load them
I've taken over a project, which contains some UltraWinGrid controls on some of the forms.
On one of the original forms which has been there since before I took on the project, there is a ContextMenuStrip, which has just one ContextMenuToolstripItem on it, captioned 'Default for Column'.
This ContextMenuStrip is hidden by default, however, when the user right-clicks on the UltraGrid, the ContextMenuStripItem is displayed on the grid (rather than at the top of them form where the ContextMenuStrip is).
I'm trying to replicate this behaviour in a new form that I've added myself, however, after adding the ContextMenuToolstripItem in, I cannot get it to display when right-clicking my grid.
I've put a breakpoint on every subroutine in the in the older forms class, and none of them are triggered when right-clicking it.
Additionally I have also searched the class for DefaultForColumnToolstripMenuItem, and the only place it appears is in the Click event of the ContextMenuToolStripItem itself.
So, how else is it possible to show it when right-clicking the grid? I've copy and pasted the ContextMenuStrip from the old form onto the new form and still nothing occurred.
I'm assuming it's in a property somewhere that I'm missing?
Check for a ContextMenuStrip property on the UltraWinGrid. You can set it in the designer and your context menu will appear on right click without having to deal with the MouseClick handler, checking the mousebutton used, etc.
I have a project I converted from VS 2008 to VS 2015 and I am having an issue with the context menu's items not updating their text when the program runs. For instance, I have an item named "Quick Dig" and I need to change it to "Quick Hitch". It shows up fine on the context menu and in the properties of the context menu, but when I run the program it still shows "Quick Dig". Similarly, when I try and add items to the context menu, the new items do not show up either. They show up fine in the context menu and in the properties, but again, when I run the program, it doesn't have them included.
How can I get the context menu to update the new text and also include the additions I am making? Nothing I have tried has helped...
I am still relatively new at VB.Net and Visual Studio and I'm assuming that this is a simple fix, but I'm not sure.
I have an asp:checkbox control on an aspx page I am working on. This checkbox is within a custom control and previously was posting back every time it was clicked. I am in the process of ajaxifying the page and have come across a problem. When I remove the attribute AutoPostBack="True" from the asp:checkbox, the vb code returns False when I check myCheckbox.checked (this is on a postback else where on the page what has not be ajaxified), even though I can see the box is indeed checked.
I am assuming that because the checkbox no longer posts back, for some reason the VB code (or the view state maybe) doesn't see it as having been checked. Is this correct, and if so, how to I correct it?
I changed the checkbox from an ASP control to be an HTML input of type checkbox and now it works :)
I am assuming that because the checkbox no longer posts back, for some reason the VB code (or the view state maybe) doesn't see it as having been checked.
This is correct, your toggling of the checkbox is happening only on the client side, so your server side is unaware of the change.
I have a tab control with two tabs. Both tabs have controls which are unique to them, but there is one control which I would like to always appear on whichever tab is currently active.
I figure I just need to add some code to TabControl1_SelectedIndexChanged().
I tried
MyControl.Parent = TabControl1.TabPages(
TabControl1.TabPages.IndexOf(TabControl1.SelectedTab))
MyControl.Parent.Update() ' is this necessary?
and I also tried
TabControl1.TabPages(
TabControl1.TabPages.IndexOf(TabControl1.SelectedTab)).Controls.Add(SeMyControl)
but neither worked (the control moved once, but when I went back to the original tab, the control did not appear there.
googling found someone suggesting
TabControl1.TabPages(TabControl1.TabIndex).Controls.Add(MyControl)
but that looks dodgy as the control is never removed from the old tab, so repeated switching would probably add the control multiple times.
I feel that I am close, but not quite ... how do I do it?
No, that works fine since Controls.Add() changes the Parent property. Which automatically removes it from the tab page it was on before. A control instance can only have one parent.
The more straight-forward approach is to simply not put the control on a tab page but leave it parented to the form which a lower Z-order so it is always on top of the tab control. The only problem with that is that the designer will hassle you. It automatically sucks the control into the tab page when you move it on top of the tab control. One trick to fix that is to leave it off the tab control and change its Location property in the form constructor.
Using your second code snippet that you are concerned about because it doesn't remove it from the original tab, why not just remove it from the original tab before you add it to the new tab?
Maybe something like: TabControl1.TabPages(TabControl1.TabIndex).Controls.Remove(MyControl)