is allowed, but in his case is not a good action/controller
Not undersatnd what do you mean?
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
<div>using (Html.BeginForm("<create>", "<PointageMateriel>"))</div><div>I suggest him put</div><div><div>using (Html.BeginForm("create", "PointageMateriel"))</div></div>
This is why Bad Request Exception comes into action
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
I made a change in my project and tried to use FORMS, it was quiet simple in front of this asp.net Mvc & EF3.5, using the wizard i did something good, i could retrieve data from the DB and display them in a DropDL, and save when clicking the "Create". BUT
!
but i couldnt hide the difference when moving from the MVC to pages that uses FORMS. (problem wth inheritence from the Master.page ...)
Then i decided to drop this ### entity framework 3.5 , described as (powerfull , new and well developped) , and i used the
L2S.
and here i found my paradise , it worked. i had to change code, it was simplier.
i regret, all the time i spent on this EF3.5 !
Now i have to move on , and start the second part of the project which is the
reporting services.
as advice : USE L2S rather than EF3.5
Thanks for all for the replies, and a special thanks to "ignatandrei"
You are perfectly right ... however, EF4 it's the new kid - and it becomes slightly better than L2S. More, L2S will be developed "on demand" - so I suggest keep the EF as a tool
ignatandrei
All-Star
137698 Points
22155 Posts
Moderator
MVP
Re: How to save the selected value of dropdownlist in DB
May 10, 2010 09:16 AM|LINK
practically in catch you must redo the same as in create to fill the dropdown :
catch (Exception Ex)
{
ModelState.AddModelError("",Ex.Message);
var items = _db.T_imputation.Select(c=>c).ToList<T_imputation>();
List<SelectListItem> itemsSelect =new List<SelectListItem>();
foreach(var item in items)
{itemsSelect.Add(new SelectListItem
{
Value = item.id_imputation.ToString(),
Text = item.Libelle
});
}
ViewData["Imputation"] = itemsSelect;
var items2 = _db.T_Materiel.Select(c => c).ToList<T_Materiel>();
List<SelectListItem> items2Select = new List<SelectListItem>();
foreach (var item in items2)
{
items2Select.Add(new SelectListItem
{
Value = item.Num_anael.ToString(),
Text = item.Libelle
});
}
ViewData["Materiel"] = items2Select;
return View();
}
ignatandrei
All-Star
137698 Points
22155 Posts
Moderator
MVP
Re: How to save the selected value of dropdownlist in DB
May 10, 2010 09:18 AM|LINK
is allowed, but in his case is not a good action/controller
imran_ku07
All-Star
45864 Points
7713 Posts
MVP
Re: How to save the selected value of dropdownlist in DB
May 10, 2010 09:23 AM|LINK
Not undersatnd what do you mean?
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
ignatandrei
All-Star
137698 Points
22155 Posts
Moderator
MVP
Re: How to save the selected value of dropdownlist in DB
May 10, 2010 10:30 AM|LINK
He had
<div>using (Html.BeginForm("<create>", "<PointageMateriel>"))</div><div>I suggest him put</div><div><div>using (Html.BeginForm("create", "PointageMateriel"))</div></div>imran_ku07
All-Star
45864 Points
7713 Posts
MVP
Re: How to save the selected value of dropdownlist in DB
May 10, 2010 11:38 AM|LINK
This is why Bad Request Exception comes into action
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
sjfs00
0 Points
22 Posts
Re: How to save the selected value of dropdownlist in DB
May 12, 2010 02:37 PM|LINK
Hi everybody !
this problem is still unresolved.
I made a change in my project and tried to use FORMS, it was quiet simple in front of this asp.net Mvc & EF3.5, using the wizard i did something good, i could retrieve data from the DB and display them in a DropDL, and save when clicking the "Create". BUT !
but i couldnt hide the difference when moving from the MVC to pages that uses FORMS. (problem wth inheritence from the Master.page ...)
Then i decided to drop this ### entity framework 3.5
, described as (powerfull , new and well developped) , and i used the
L2S.
and here i found my paradise , it worked. i had to change code, it was simplier.
i regret, all the time i spent on this EF3.5 !
Now i have to move on , and start the second part of the project which is the reporting services.
as advice : USE L2S rather than EF3.5
Thanks for all for the replies, and a special thanks to "ignatandrei"
Good Luck Folks !
ignatandrei
All-Star
137698 Points
22155 Posts
Moderator
MVP
Re: How to save the selected value of dropdownlist in DB
May 12, 2010 05:40 PM|LINK
You are perfectly right ... however, EF4 it's the new kid - and it becomes slightly better than L2S. More, L2S will be developed "on demand" - so I suggest keep the EF as a tool
Thank you for the kind words!