Click here to Skip to main content
15,923,168 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to get TargetControlID from gridview to Ajax modalPopupExtender? Pin
Dhyanga14-Mar-11 6:06
Dhyanga14-Mar-11 6:06 
AnswerRe: How to get TargetControlID from gridview to Ajax modalPopupExtender? Pin
Ali Al Omairi(Abu AlHassan)15-Mar-11 12:45
professionalAli Al Omairi(Abu AlHassan)15-Mar-11 12:45 
AnswerRe: How to get TargetControlID from gridview to Ajax modalPopupExtender? Pin
Prasanta_Prince31-May-11 0:11
Prasanta_Prince31-May-11 0:11 
Questioni Can not access to Gridview/ Ajax with Master Page Pin
Honeyboy_2014-Mar-11 4:27
Honeyboy_2014-Mar-11 4:27 
AnswerRe: i Can not access to Gridview/ Ajax with Master Page Pin
Sandeep Mewara14-Mar-11 4:55
mveSandeep Mewara14-Mar-11 4:55 
GeneralRe: i Can not access to Gridview/ Ajax with Master Page Pin
Honeyboy_2014-Mar-11 5:05
Honeyboy_2014-Mar-11 5:05 
AnswerRe: i Can not access to Gridview/ Ajax with Master Page Pin
Ali Al Omairi(Abu AlHassan)15-Mar-11 13:27
professionalAli Al Omairi(Abu AlHassan)15-Mar-11 13:27 
QuestionDropDownList - MVC3 Razor Application Pin
dotman114-Mar-11 0:32
dotman114-Mar-11 0:32 
Using EF Code First, I have implemented a dropdownlist on a create method everything works fine
however duplicate records are posted as the method is called twice.
Any idea what I have not implemented correcty.

Model(s)

public class Country
{
public int CountryId { get; set; }
public string Name { get; set; }
}

public class State
{
public int StateId { get; set; }
[Required(ErrorMessage = " Name is required")]
public string Name { get; set; }
[Required(ErrorMessage = " Code is required")]
public string Code { get; set; }

public virtual Country Country { get; set; }

[Required(ErrorMessage = " The Country is required")]
public int CountryId { get; set; }

}

Controller (partial)

[HttpPost]
public ActionResult Create(State newState)
{
ViewData["Countries"] = db.Countries.ToList();
try
{
// TODO: Add insert logic here
db.States.Add(newState);
db.SaveChanges();

return RedirectToAction("Index");
}
catch
{
return View(newState);
}
}

View (Partial)

<div class="editor-label">
@Html.LabelFor(model => model.CountryId)
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.CountryId, new SelectList(ViewBag.Countries, "CountryId", "Name"))
@Html.ValidationMessageFor(model => model.CountryId)
</div>

Regards
dotman1

AnswerRe: DropDownList - MVC3 Razor Application Pin
Sandeep Mewara14-Mar-11 5:00
mveSandeep Mewara14-Mar-11 5:00 
GeneralRe: DropDownList - MVC3 Razor Application Pin
dotman115-Mar-11 3:10
dotman115-Mar-11 3:10 
Questionrighet click on tree view? Pin
shima-201113-Mar-11 21:23
shima-201113-Mar-11 21:23 
AnswerRe: righet click on tree view? Pin
Ali AlOmairi (TJIC)13-Mar-11 22:56
Ali AlOmairi (TJIC)13-Mar-11 22:56 
Questionhow to stream uploaded document in asp Pin
nelmaigen12-Mar-11 15:03
nelmaigen12-Mar-11 15:03 
AnswerRe: how to stream uploaded document in asp Pin
Sandeep Mewara14-Mar-11 5:07
mveSandeep Mewara14-Mar-11 5:07 
QuestionCan we open a ASP classic fourm? Pin
lambright12-Mar-11 7:10
lambright12-Mar-11 7:10 
AnswerRe: Can we open a ASP classic fourm? Pin
Abhijit Jana12-Mar-11 7:48
professionalAbhijit Jana12-Mar-11 7:48 
AnswerRe: Can we open a ASP classic fourm? Pin
Keith Barrow12-Mar-11 8:02
professionalKeith Barrow12-Mar-11 8:02 
QuestionAdd an '&' (ampersand ) character to a string. Pin
codingrocks11-Mar-11 21:36
codingrocks11-Mar-11 21:36 
AnswerRe: Add an '&' (ampersand ) character to a string. Pin
R. Giskard Reventlov11-Mar-11 21:50
R. Giskard Reventlov11-Mar-11 21:50 
QuestionASP.NET free web hosting Pin
εїзεїзεїз11-Mar-11 19:00
εїзεїзεїз11-Mar-11 19:00 
AnswerRe: ASP.NET free web hosting Pin
adkalavadia14-Mar-11 2:45
adkalavadia14-Mar-11 2:45 
Questionrightclick on tree view? Pin
shima-201111-Mar-11 18:16
shima-201111-Mar-11 18:16 
AnswerRe: rightclick on tree view? Pin
thatraja11-Mar-11 18:30
professionalthatraja11-Mar-11 18:30 
GeneralRe: rightclick on tree view? Pin
shima-201112-Mar-11 0:37
shima-201112-Mar-11 0:37 
GeneralRe: rightclick on tree view? Pin
thatraja12-Mar-11 1:00
professionalthatraja12-Mar-11 1:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.