Search

You searched for the word(s): userid:742079

Matching Posts

  • Getting control from PartialCachingControl without an executed page

    Hi, I'm having an issue with dynamically loading user-controls that have OutputCaching defined. In order to get the underlying control from a PartialCachingControl microsoft says: "Before you check the CachedControl property, add the user control to the control tree". However, I am in a peculiar situation where that doesn't quite work: I am rendering controls with a "dummy page", and the rendered html is returned for AJAX. Here's the code: RendererPage page = new RendererPage
    Posted to Web Forms (Forum) by joniba on 11/22/2009
  • Re: Hiding root node in TreeView control

    [quote user="site400"] For those who are using an XMLDataSource, you can set the DataSource's XPath property to "/*/*" , which will then populate the TreeView starting with the first node below the root. [/quote] Thank you sir! Finally a reasonable answer!
    Posted to Data Presentation Controls (Forum) by joniba on 11/12/2009
  • Re: Maintaining scope in delegate/lambda

    [quote user="JeffreyABecker"] Because closures capture the variable , not the value . In the case you gave, the variable row is scoped outside the body of the loop, yet still 'within the loop' where the parentId variable is scoped within the body of the loop. [/quote] So you are saying that variables defined within the parentheses of the foreach (as in foreach( this stuff here )) are in a higher scope than what is within the foreach curly braces (as in foreach(...){ this stuff here
    Posted to C# (Forum) by joniba on 10/27/2009
  • Re: Maintaining scope in delegate/lambda

    [quote user="Paul Linton"] The first FromData has three parameters and the second has four parameters. When the first case did not work, how did it not work (compile error, runtime error, too many results, no results, wrong results)? Is the data the same in both cases? If you take the second case and remove the bold line and change the inner lambda to use row.ParentId, does that work? [/quote] Ah, sorry, it's just a copy/paste issue. In the first example I just deleted some commented
    Posted to C# (Forum) by joniba on 10/26/2009
  • Re: Maintaining scope in delegate/lambda

    OK, I think I've found a solution. But I would really appreciate it if anyone can explain to me why the following works while the code in the previous post does not: // // Build the collection of entities from the dataset // foreach (var row in dataset.cms_Categories) { int parentId = row.ParentId; tree.Add ( Category.FromData ( row.CategoryId, row.CategoryName, row.IssortExpretionNull() ? string.Empty : row.sortExpretion, new Lazy<Category>(() => Find(category => category.Id == parentId
    Posted to C# (Forum) by joniba on 10/25/2009
  • Maintaining scope in delegate/lambda

    Hi all, there's probably a simple solution to this problem but I just can't see it. I'm using a wrapper class called "Lazy" to wrap class members whose evaluation I want to be delayed until they are accessed (details here , if anyone is interested). This wrapper accepts a delegate, which is used to evaluate the wrapped member. Here's some code: // // Build the collection of entities from the dataset // foreach (var row in dataset.cms_Categories) { tree.Add ( Category.FromData
    Posted to C# (Forum) by joniba on 10/25/2009
    Filed under: delegates, scope
  • Re: extensions methods and reassigning the "this" variable

    Hi Figo, thanks for the response. I would like to understand a little more in detail if you are willing to explain. [quote user="Figo Fei - MSFT"]the new array "source" where the element added to is just created and past to the local variable "source"[/quote] So if I created the same logic using a static method and passed the the source parameter by reference, it would work? Or does the very fact that the "source" variable is an interface mean that even passing
    Posted to C# (Forum) by joniba on 7/17/2009
  • Re: extensions methods and reassigning the "this" variable

    First of all, the extension method should return void, not IEnumerable<TSource>, sorry. [quote user="mbanavige"] what happens if you use the "out" keyword with your source variable? [/quote] That's not allowed in C# (syntactically).
    Posted to C# (Forum) by joniba on 7/15/2009
  • extensions methods and reassigning the "this" variable

    A bizarre question but one that I would really like to have answered, if anyone knows. The following test fails: [TestMethod] public void TestIEnumberableQuirks() { int[] ints = new int[] { 1, 2 }; ints.Add(3); Assert.AreEqual(3, ints.Length); } with a using to the following extensions class: public static class Extensions { public static IEnumerable<TSource> Add<TSource>(this IEnumerable<TSource> source, TSource element) { source = source.Concat(new TSource[] { element }); } }
    Posted to C# (Forum) by joniba on 7/14/2009
  • Re: Getting resource name

    Actually my proposed solution, after some research, to the original question, is: /// &lt;summary&gt; /// Returns a dictionary of the name/value pairs of the managed resource-file /// </summary> public static Dictionary< string , string > BuildResourceDictionary(ResourceManager manager) { Dictionary< string , string > resourceDict = new Dictionary< string , string >(); ResourceSet resourceSet = manager.GetResourceSet(CultureInfo.CurrentUICulture, true , true ); IDictionaryEnumerator
    Posted to Localization (Forum) by joniba on 4/20/2009
Page 1 of 3 (26 items) 1 2 3 Next >