i have grid in View like this
@RequestId
now in controller i have actionresult like this
public ActionResult InsertRequest(RequestModel RM, string strRequestId)
{
//if(ModelState.IsValid)
//{
if(strRequestId != "" || strRequestId != null)
{
RM.HubList.Add(new SelectListItem { Value = "BLR", Text = "BLR" });
DataAccessLayer.DBData objDB = new DataAccessLayer.DBData();
string strSelected = Request.Form["strSelectedHub"].ToString();
string strRes = objDB.InsertData(RM);
ViewData["InSertResult"] = strRes;
ModelState.Clear();
return View(RM);
}
{
//if(ModelState.IsValid)
//{
if(strRequestId != "" || strRequestId != null)
{
RM.HubList.Add(new SelectListItem { Value = "BLR", Text = "BLR" });
DataAccessLayer.DBData objDB = new DataAccessLayer.DBData();
string strSelected = Request.Form["strSelectedHub"].ToString();
string strRes = objDB.InsertData(RM);
ViewData["InSertResult"] = strRes;
ModelState.Clear();
return View(RM);
}
}
now i need to get differnetiate between edit and delete and display the same view .. how i can do it?
Francis SusaimichaelRank #466 · 5.4K reputationPosted Dec 11, 2015, 3:07 AM EST
@Html.ActionLink("Edit", "InsertOrEditAction", new { mode = "edit" })
{
string strViewName = "";
if(mode == "insert")
{
strViewName="InsertView";
}
else if(mode == "edit")
{
strViewName="EditRecord";
}
return View(strViewName);
}
Manas MohapatraRank #182 · 13.2K reputationPosted Dec 11, 2015, 3:30 AM EST
{
if(strRequestId != "" || strRequestId != null)
{
Aniruddha Nargund83 reputationPosted Dec 13, 2015, 9:57 PM EST
Francis SusaimichaelRank #466 · 5.4K reputationPosted Dec 13, 2015, 11:28 PM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts