Dr.Ajay Kashyap

Dr.Ajay Kashyap

  • NA
  • 521
  • 283.8k

First Letter In Uppercase in Asp.net Mvc

Feb 14 2017 1:44 AM
for (i = 0; i < result; i++)
{
string SubCat = MyArrayUpper[i].Trim();
 
foreach (var scn in subcategoryname)
{
var Subcategory_name = scn.SubCategory.Trim();
Subcategory_name = Subcategory_name.ToUpper();
if (SubCat == Subcategory_name)
{
active = true;
}
}
if (active == false)
{
string subcat1 = SubCat;  /// subcat1  this is the varaible in which i am storing value 
 
//// and here i want First Letter In Uppercase before storing in db 
 
subcat1 =char.ToUpper(subcat1[0]) + subcat1.Substring(1);
 

var NewSubCAtegory = db.MasterSubCategories.Create();
NewSubCAtegory.SubCategory = subcat1;
db.MasterSubCategories.Add(NewSubCAtegory);
db.SaveChanges();
}
}

Answers (9)