i have a form which have gujarati text input and want to insert it into my database, the font-family that i added show me that i am typing gujarati but during insert it is just plain old english so how to do it here is what i have tried so far:
my model:
public class Insert_News
{
public int Newscategory { get; set; }
public string NewsTitle { get; set; }
public string NewsDescription { get; set; }
public string ImageUrl { get; set; }
public bool IsActive { get; set; }
}
my controller:
public ActionResult Index()
{
var query = (from c in db.NewsCategories where c.IsActive == true select new { Text = c.CategoryName, Value = c.NewsCategoryID }).ToList();
ViewBag.category = query;
return View();
}
[HttpPost]
public ActionResult Index(Insert_News ns, HttpPostedFileBase ImageUrl)
{
var query = (from c in db.NewsCategories where c.IsActive == true select new { Text = c.CategoryName, Value = c.NewsCategoryID }).ToList();
ViewBag.category = query;
db.USP_Insert_NewsDetail(ns.Newscategory, ns.NewsTitle.ToString(), ns.NewsDescription.ToString(), ns.ImageUrl);
string s1, s2, s3, s4;
return View(ns);
}
my View is as follows:
@using (Html.BeginForm("Index", "BhoomiNews", FormMethod.Post, new { @id = "insertnewsform", @enctype = "multipart/form-data", lang = "gu-IN" }))
{
@Html.AntiForgeryToken()
<div class="well-lg">
<div class="form-horizontal" style="padding-removed5%;">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
<label class="forlabel">News Category</label><br /><br />
<div class=" col-lg-10">
@*style="margin-left:-8.4%;"*@
@Html.DropDownList("NewsCategory", new SelectList(@ViewBag.category, "Value", "Text"), "Select Category", new { @class = "form-control forinput", id = "News_Category", @style = "width:102.7%;margin-top:-1.7%;" })
@Html.ValidationMessageFor(model => model.NewsTitle, "", new { @class = "text-danger" })
</div>
</div><br />
<div class="form-group">
<label class="forlabel">News Title</label><br /><br />
<div class="col-lg-10">
@*style="margin-left:-5.7%;"*@
@Html.TextAreaFor(model => model.NewsTitle, new { @class = "form-control forinput", rows = "2", cols = "3", id = "txtnewstitless", @style = "margin-top:-1.7%;font-family:Vakil_01;" })
@Html.ValidationMessageFor(model => model.NewsTitle, "", new { @class = "text-danger" })></div>
</div><br />
<div class="form-group">
<label class="forlabel">News Description</label><br /><br />
<div class="col-lg-10">
@*style="margin-left:-10.5%;"*@
@Html.TextAreaFor(model => model.NewsDescription, new { @class = "form-control forinput", rows = "6", cols = "5", @style = "margin-top:-1.7%;font-family:Vakil_01;" })
@Html.ValidationMessageFor(model => model.NewsDescription, "", new { @class = "text-danger" })
</div>
</div>
<br />
<div class="form-group">
<label class="forlabel">News Image</label><br /><br />
<div class="col-lg-10">
@*style="margin-left:-7%;"*@
<input type="file" data-val="true" data-val-required="please select a file" class="form-control forinput" required name="ImageUrl" id="nwsimg" style="margin-top:-1.7%;" />
@Html.ValidationMessageFor(model => model.ImageUrl, "", new { @class = "text-danger" })
</div>
</div>
<br />
<div class="form-group">
<div class="col-lg-2">
<button type="button" value="Add" class="btn btn-primary" id="btnaddnews" style=" width:100%;padding:10px 0;min-width:35%;">Add</button>
<div style="color:red;">@TempData["errormsg"]</div>
</div>
</div>
</div>
</div>
}
the following img shows the problem:
please refer this images:
my View:
http://s1.postimg.org/u5ef6y50v/myview.png[
^]
my-controller:
http://s30.postimg.org/9qb4g271t/mycontroller.png[
^]