Sunday, November 16, 2014

HTML Decode a single column of string field in a Data Table

 /// <summary>
        /// HTML Decode a single column of string field in a Data Table
        /// </summary>-
        /// <param name="dTable"></param>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        public static DataTable HtmlDecodeDataTable(DataTable dTable, string fieldName)
        {
            foreach (DataRow drow in dTable.Rows)
            {
                if (drow[fieldName] != null && drow[fieldName] is string)
                {
                    drow[fieldName] = System.Web.HttpUtility.HtmlDecode((drow[fieldName].ToString()));
                }
            }
            dTable.AcceptChanges();
            return dTable;
        }

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...