Posts by Roger Medeiros • 291 points
7 posts
-
0
votes2
answers4575
viewsA: error "Undefined object reference to an instance of an object." when displaying a null value in the view
You can use ? to print possible null objects. <tbody> @foreach (var usuario in @Model.OrderBy(usuario => usuario.Nome)) { <tr> <td>@usuario.Matricula?.ToUpper()</td>…
-
0
votes2
answers387
viewsA: Export Database Table to XLSX without Interop
I use a component that creates the XLSX directly by Openxml not needing Excel installed on the machine or server. Following example:…
-
4
votes4
answers2691
viewsA: Reports with Asp.Net MVC
I like iTextShap. It’s free and easy to use. I have an example code with mvc on github. Source code for the example:…
-
0
votes4
answers2259
viewsA: How to display a Javascript message in an Asp.net MVC view?
Have you tried using @Html.Raw("<script>............</script>"); ?
-
3
votes2
answers291
viewsA: How to standardize Datetime format for all type fields without using Displayfor or Editorfor in MVC?
Hello I find it a better practice to create a component that generates the text on the screen. Example: namespace IM.Framework.MVC { using System; using System.Text; using System.Web.Mvc; public…
-
0
votes1
answer191
viewsA: Saving a binary xls to SQL Server
I usually save the documents in the database in GZIP format converted to Base64 to avoid encoding problem. using (var db = IMBase.getNewDBContext()) { var anexo = db.AtendimentoAnexo.Create();…
-
2
votes2
answers1392
viewsA: Viacep does not fill in user address data (Website on the .NET platform)
I use the Post Office itself. Example of Consumption: using (var ws = new AtendeClienteClient()) { var resposta = ws.consultaCEP(cep); Console.Clear(); Console.WriteLine(String.Format("Endereço :…