TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
imran bhatti
NA
28
5.4k
mvc getting an error on converting ADT_DIST_CODE
Dec 22 2016 3:05 AM
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
RTC_PRINT_XMLEntities db = new RTC_PRINT_XMLEntities();
ViewBag.District = new SelectList(db.RTC_XML_ADT, "ADT_DIST_CODE", "ADP_DIST_NAME");
return View();
}
public JsonResult GetTalukById(string ID)
{
List<SelectListItem> taluk = new List<SelectListItem>();
var talukList = this.Gettaluk(Convert.ToInt32(ID));
var talukData = talukList.Select(m => new SelectListItem()
{
Text = m.ADT_TALUK_NAME,
Value = m.ADT_TALUK_CODE.ToString(),
});
return Json(talukData, JsonRequestBehavior.AllowGet);
}
public IList<RTC_XML_ADT> Gettaluk(int ADT_DIST_CODE_ID)
{
RTC_PRINT_XMLEntities db = new RTC_PRINT_XMLEntities();
return db.RTC_XML_ADT.Where(m => m.ADT_DIST_CODE == ADT_DIST_CODE_ID).ToList();
}
[HttpPost]
public ActionResult Index(FormCollection formdata)
{
// Get Employee information to insert into Data Base
return RedirectToAction("Index", "Home");
}
}
}
i am getting error on this line
RTC_PRINT_XMLEntities db = new RTC_PRINT_XMLEntities();
return db.RTC_XML_ADT.Where(m => m.ADT_DIST_CODE == ADT_DIST_CODE_ID).ToList();
ADT_DIST_CODE it is howing as a string.
ADT_DIST_CODE_ID it is as int bcoz i put integer there in parameter
how to solve this problem.
Reply
Answers (
10
)
how to create thumbnail of image
Convert Vb6 code to Vb or C#