Note that there are some explanatory texts on larger screens.

plurals
  1. POA Simple Helper Class doesn't work
    primarykey
    data
    text
    <p>Sorry for asking such a simple question but I lost really long time trying to solve this. At the end, I decide to ask you. </p> <p>Let's start with the code base : </p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace Navigation.Helpers { public static class NavigationBarSE { public static MvcHtmlString RenderNavigationBarSE(this HtmlHelper helper, String[] includes) { return new MvcHtmlString("Y U no Work??"); //NavTypeSE res = new NavTypeSE(includes); //String ress = res.toString(); //return new MvcHtmlString(ress); } } } </code></pre> <p>In the original form, this helper needs to return a String that produced by the NavTypeSE class. But in the end, to get a result, I only want it to return a String for me... But it didn't do that...</p> <p>Before you ask, I can say that, </p> <pre><code>&lt;add namespace="Navigation.Helpers"/&gt; </code></pre> <p>exists in my Web.config file in Views folder. </p> <p>For detailed information, my NavTypeSE class as below : </p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Navigation.Helpers { //Creates a Navigation Menu Type which includes Previous, Next and Validate Buttons public class NavTypeSE { Boolean pr, nt, vld; Boolean Previous { get; set; } Boolean Next { get; set; } Boolean Validate { get; set; } public NavTypeSE(Boolean Previous, Boolean Next, Boolean Validate) { this.pr = Previous; this.nt = Next; this.vld = Validate; } public NavTypeSE() { } public NavTypeSE(String[] inc) { for(int i=0; i&lt;inc.Length; i++)//foreach (String s in inc) { String s = inc[i]; // Don't need for foreach method. if (s.Equals("previous")||s.Equals("Previous")) { this.pr = true; } else if (s.Equals("next") || s.Equals("Next")) { this.nt = true; } else if (s.Equals("validate") || s.Equals("Validate")) { this.vld = true; } else { this.pr = false; this.nt = false; this.vld = false; } } public String toString() { return "Previous: " + this.pr + ", Next: " + this.nt + ", Validate: " + this.vld; } } } </code></pre> <p>Also, in my View, I call this Helper like below : </p> <pre><code>@{ String[] str = new String[] { "Previous", "next", "Validate" }; Html.RenderNavigationBarSE(str); } </code></pre> <p>This is just a base for a project. And I'm starter level in both C# and ASP.NET MVC Platform. Sorry for spending your time. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload