asp.net mvc - Razor If-condition not working -


I can not find the status of the string comparison status to work here is the code for my forwarding block.

  @forch (Miscellaneous items in the model) {& lt; Tr onclick = "getData ('@ item.DiscountDescs');" & Gt; & Lt; TD & gt; & Lt; / TD & gt; & Lt; Td> @ Html.DisplayFor (model item = & gt; item discountedsection) & lt; / Td> & Lt; TD & gt; @if (string. Eclosses (item discount format, "c")) {@: card} and {@: other} & lt; / Td> & Lt; Td> @ Html.DisplayFor (model item => item discount type) & lt; / Td> & Lt; Td> @ Html.DisplayFor (model item => item discounted mode) & lt; / Td> & Lt; Td> @ Html.DisplayFor (ModelEystem => Item.DISView) & lt; / Td> & Lt; Td> @ Html.DisplayFor (ModelEystem => Items.Active) & lt; / Td> & Lt; Td> @ Html.DisplayFor (model item => items.isshamy) & lt; / Td> & Lt; / TR & gt; }   

TD displays will always be "Other".

You have to trim the value coming from the database.

Use trim () function

  item.DiscountForm.Trim ()   

this extra space And will compare with the string.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -