Why is my cache item not nulled after Cache.Remove call? - asp.net

I'm trying to remove a specific item from the ASP.NET Cache in order to force a reload. Something like this:
System.Web.HttpContext.Current.Cache.Remove(SomeKey);
But then I check it immediately afterward, and Cache[SomeKey] is NOT null. It still contains a reference to this item I want to clear. Am I missing something obvious here?

OK, I figured it out... turns out I had a property in my Watch debug window, which had a side effect of priming the cache. So even though I was looking at the Cache object it was actually being instantly updated with a new value every time it was cleared. Embarrassing.

Related

ASPxClientListBox loses values and the first item can not be selected

On a server control I have a DevExpress ASPxClientListBox which is populated dynamically on the client. The server does not need to know anything about it but it is initialized on the server. Normally this server control does not have any problems... however, if I put it in an ASPxCallbackPanel it will work on the first page load but, after a callback, if the ListBox's client side selected index changed event is fired, the selected items values are lost and "undefined" though the keys or "texts" are intact.
On a side note... after a callback the first item in the ListBox can not be selected.... what I mean is that the first item is not highlighted on mouseover or mouseclick.
Links which are slightly relevant but not what I need:
http://www.devexpress.com/Support/Center/p/Q312536.aspx
I had another link that talked about the "unable to select first item" issue and said that it had something to do with adding the items prior to the control hierarchy being established so the solution was to add the items in the ListBox client side Init event as opposed to the page_load event. I am adding the items after the ListBox has been initialized so I don't see this as a solution ... and I can't find the link now anyways...
Edit: I just found that other link again: http://www.devexpress.com/Support/Center/p/Q367021.aspx
Part of the problem is addressed in the second link you provided. What happens is that...
...this function is called immediately when a page is loaded. However,
an ASPxListBox hierarchy is not yet ready. The correct way to call the
getList function is to handle the ASPxClientListBox event...
To cut the long story short, something like the following won't execute properly if you run it e.g. on load...
yourListbox.AddItem("Test1");
yourListbox.AddItem("Test2");
yourListbox.AddItem("Test3");
yourListbox.AddItem("Test4");
...but the following should work...
s.Properties.ClientSideEvents.Init =
#"function(s, e) { yourListbox.AddItem('Test1'); yourListbox.AddItem('Test2'); yourListbox.AddItem('Test3'); yourListbox.AddItem('Test4'); }";
I guess the first selected-items-problem could have happened for the same or similar reason.

Why won't this checkbox refresh as expected in Meteor?

I'd like to simplify the TodoMVC app for meteor. There is currently some observe that should not be needed I think. I simplified a bit successfully, but when I try to simplify it further the updating doesn't work properly.
For instance, it should get selected when I click on all the items in the todo list but doesn't. When I refresh the page it is selected though.
Edit: Got rid of an unrelated error, thanks to #TomColeman.
I'm seeing that error before the patch is applied. It's due to the Meteor.flush on line 74.
I'm not sure why that flush is needed? (I'm also not sure why there's an error either).
Turns out it simply was because the correct html is checked="checked", not simply checked.

ASP.NET ScriptManager not setting history points?

I have an Ajax enabled website, with some calls to the Script Manager to set history points like so:
if (uxScriptManager.IsInAsyncPostBack)
{
uxScriptManager.AddHistoryPoint("x", taxid.ToString());
}
This works just fine 90% of the time.
However, about 10% of the time, the history points stop being set. This seems to happen when I've clicked around a bit and then start using the back button to go back pretty far (usually 6 or 7 steps in the history).
Has anyone else noticed/seen this behavior? The code I've got that picks up the state information from the history points to rebuild the page seems to work fine.It's just sometimes the script manager seems to forget to set the history point.
EDIT
I've noticed some strange behavior with the script manager - after the third or the fourth click back, is seems to break and the Ajax calls no longer work. The user needs to reload the page in order for the history to start working again. Anyone seen this type of behavior? (I'd think if I wasn't doing it right, it wouldn't work at all...)

ASP.NET 3.5 - Making a field readonly/unmodifiable without "disabling" it

I have a web application with a form that has disabled fields in it. It allows a "Save As" function which basically means the settings can be copied into a new configuration (without being modified) and in the new configuration they can be changed to something else. The problem I am running into with this is that since the fields are disabled, they are not getting posted through and do not appear in the context object on the server side.
When I removed the logic to disable the fields, that part works fine. So the remaining problem is, how to "disable" the fields (not allow any change of the data in any of the entry fields) without really "disabling" them (so that the data gets posted through when saving)?
I was originally looking for a way to do this in CSS but not sure if it exists. The best solution is of course, the simplest one. Thanks in advance!
(Note: by 'disabled' I mean "The textboxes display but none of the text inside of them can be modified at all". It does not matter to me whether the cursor appears when you click inside it, though if I had a preference it would be no cursor...)
http://www.w3schools.com/TAGS/att_input_readonly.asp
readonly attribute is what you want.
i would suggest that instead of using the non-updateable field values from the page's inputs, you retrieve the original object from the DB and copy them from there. It's pretty trivial using something like Firebug to modify the contents of the page whose form will be posted back to modify the values, even if they are marked as readonly. Since you really want the values from the original, I would simply reget the object and copy them. Then you don't need to worry about whether the original (and non-updateable) properties get posted back at all.

How to turn on line number tooltip while scrolling infragistics ultrawebgrid

I once saw this feature in action but I don't know how to turn it on. The grid can show a tooltip with the current row number (or row ID) while dragging the scrollbar. This helps you to stop the scroll in the right place. I'm assuming some property will turn this on, but I can't find it.
Maybe it is also dependent on the scroll mode?
UPDATE:
In the image below you can see an example of the tooltip I'm looking for. This is displayed while the scrollbar is being dragged (up or down). The number in the tooltip is the row number (you can't see it in this image, way to the left in the grid). This is the same grid that I am using now. Just from a very old build of our product. Somehow this tooltip was turned off. And no one knows how to turn it back on :(
I'm pretty sure this is a built in feature of the ultrawebgrid. Not something that required extra coding.
alt text http://img138.imageshack.us/img138/6337/croppercapture.jpg
Right! Now that we've established that you have version 6.3, I've hopefully got a solution for you. I don't have 6.3 myself, but I've got a slightly later one that I think didn't have Virtual Scrolling added as a feature yet.
So try this code:
webgrid.DisplayLayout.XmlLoadOnDemandType = XmlLoadOnDemandType.Virtual;
This should automatically put a tooltip on the grid as you scroll down. Have a look here for a running sample... (and remember to choose the virtual option)
Here's hoping!
Rob G
I don't know if there's a UltraWebGrid property to simply turn on the behavior you're looking for. I almost suspect you experienced this feature in another application, perhaps not even a web based one (sorry!). I do however, know exactly what you're talking about.
As a work-around, I would suggest allowing the user to input the destination row number, and to simply "jump" to it, using this technique.
If that doesn't satisfy you, it may be possible to achieve this behavior with JavaScript. You would need to use something like this technique to get the information you need, estimate (or actually detect, if possible) the row number, and the rest is up to the GUI. I would go with the work-around described above though :)
I'm typing this from memory here as I don't have it installed on this machine and I haven't seen that setting before, but how about adding something like this to the InitializeRow event:
foreach (UltraGridCell cell in e.Row.Cells)
{
if(cell.Column.Key == "Topic") //from your grid above
cell.Title = cell.Row.Index;
}
The row object itself does not have a "Title" property from memory, but the cell does.
See if that works...
Regards,
Rob G
OK - I think I've found your illusive setting:
You can set the TipStyleScroll on the Override to Show on the Grid (this may be version dependant).
You can determine which field is displayed as the tooltip by using the ScrollTipField property of the band.
I did it like so:
myGrid.DisplayLayout.Override.TipStyleScroll = TipStyle.Show;
myTopBand.ScrollTipField = "Id";
...and it works like a charm!
If it's a really long list, sometimes setting the ScrollStyle to Deferred helps:
myGrid.DisplayLayout.ScrollStyle = ScrollStyle.Deferred;
Hope that helps...
Rob G
Once again - not sure which version you have, so to be safe here's somthing you can try from 2009 version:
myGrid.Behaviors.VirtualScrolling.Enabled = true;
myGrid.Behaviors.VirtualScrolling.TooltipVisibility = DefaultableBoolean.True;
If your scrolling mode is Deferred instead of Virtual, then the tooltip is normally enabled by default.
You can find full details about this feature here
Hope that helps,
Rob G

Resources