Search Results

Search found 4 results on 1 pages for 'kouphax'.

Page 1/1 | 1 

  • Inline HTML Syntax for Helpers in ASP.NET MVC

    - by kouPhax
    I have a class that extends the HtmlHelper in MVC and allows me to use the builder pattern to construct special output e.g. <%= Html.FieldBuilder<MyModel>(builder => { builder.Field(model => model.PropertyOne); builder.Field(model => model.PropertyTwo); builder.Field(model => model.PropertyThree); }) %> Which outputs some application specific HTML, lets just say, <ul> <li>PropertyOne: 12</li> <li>PropertyTwo: Test</li> <li>PropertyThree: true</li> </ul> What I would like to do, however, is add a new builder methid for defining some inline HTML without having to store is as a string. E.g. I'd like to do this. <% Html.FieldBuilder<MyModel>(builder => { builder.Field(model => model.PropertyOne); builder.Field(model => model.PropertyTwo); builder.ActionField(model => %> Generated: <%=DateTime.Now.ToShortDate()%> (<a href="#">Refresh</a>) <%); }).Render(); %> and generate this <ul> <li>PropertyOne: 12</li> <li>PropertyTwo: Test</li> <li>Generated: 29/12/2008 <a href="#">Refresh</a></li> </ul> Essentially an ActionExpression that accepts a block of HTML. However to do this it seems I need to execute the expression but point the execution of the block to my own StringWriter and I am not sure how to do this. Can anyone advise?

    Read the article

  • Silverlight Two Way Data Binding on Key Up

    - by kouPhax
    Is there a way to fire a two way data bind when the key up event fires in Silverlight. Currently I have to lose focus on the textbox to get the binding to fire. <TextBox x:Name="Filter" KeyUp="Filter_KeyUp" Text="{Binding Path=Filter, Mode=TwoWay }"/>

    Read the article

  • Force lowercase property names from Json() in ASP.NET MVC

    - by kouPhax
    Given the following class, public class Result { public bool Success { get; set; } public string Message { get; set; } } I am returning one of these in a Controller action like so, return Json(new Result() { Success = true, Message = "test"}) However my client side framework expects these properties to be lowercase success and message. Without actually having to have lowercase property names is that a way to acheive this thought the normal Json function call?

    Read the article

  • Use of const in a method

    - by kouPhax
    In the following method, public void InspectList(IList<int> values) { if(values != null) { const string format = "Element At {0}"; foreach(int i in values) { Log(string.Format(format, i)); } } } Does the use of const provide any benefit over just declaring the string as a string? Woudl it not be interned anyway?

    Read the article

1