Click here to Skip to main content
15,889,027 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionhow to pass two or more .aspx pages to response.redirect(),is it possible or not? Pin
Ravi900kumar18-Jan-14 22:57
Ravi900kumar18-Jan-14 22:57 
AnswerRe: how to pass two or more .aspx pages to response.redirect(),is it possible or not? Pin
Kornfeld Eliyahu Peter19-Jan-14 0:32
professionalKornfeld Eliyahu Peter19-Jan-14 0:32 
GeneralRe: how to pass two or more .aspx pages to response.redirect(),is it possible or not? Pin
Gopi Kishan Mariyala22-Jan-14 0:40
Gopi Kishan Mariyala22-Jan-14 0:40 
QuestionReport Like display in the UI Web control Pin
indian14317-Jan-14 6:59
indian14317-Jan-14 6:59 
AnswerRe: Report Like display in the UI Web control Pin
indian14321-Jan-14 5:51
indian14321-Jan-14 5:51 
GeneralRe: Report Like display in the UI Web control Pin
thatraja21-Jan-14 15:57
professionalthatraja21-Jan-14 15:57 
AnswerRe: Report Like display in the UI Web control Pin
thatraja21-Jan-14 15:59
professionalthatraja21-Jan-14 15:59 
QuestionCannot get ViewModel in MVC5 to work Pin
AlexHarmes17-Jan-14 4:42
AlexHarmes17-Jan-14 4:42 
I am trying to incorporate a ViewModel as I am using edmx file to define my db, but my view only works with the edmx model and sends an unexpected result when I use my ViewModel.

My ViewModel is;
C#
 public class GetQuestionViewModel
{
     public class Question {
     public Question Questions { get; set; }
     public Response Response { get; set; }
     }
     public GetQuestionViewModel()
     {
         this.QuestionOptions = new HashSet<QuestionOption>();
         this.Responses = new HashSet<Response>();
     }
     [Key]
     public int Id { get; set; }
     public int PageNumber { get; set; }
     public string Question1 { get; set; }
     public int QuestionTypeId { get; set; }
     public Nullable<int> LinkedTo { get; set; }
     public Nullable<int> Options { get; set; }
     public Nullable<int> QuestionRanking { get; set; }

     public virtual ICollection<QuestionOption> QuestionOptions { get; set; }
     public virtual QuestionType QuestionType { get; set; }
     public virtual ICollection<Response> Responses { get; set; }
}


And my Action is;
[HttpGet]
public ActionResult ViewQuestion(int? id)
{
    if (id == null || id == 0 || id > 13)
    {
        id = 8;
    }
    Question question = db.Questions.Find(id);

    if (question == null)
    {
        return HttpNotFound();
    }
    return View(question);
}


I tried changing the
Question question = db.Questions.Find(id);
to
var question = db.Questions.Find(id);

but nothing I have tried works. I want to get the ViewModel working before I build the query;
Question questions =  (from q in db.Questions
        from qo in q.QuestionOptions.DefaultIfEmpty()
        from r in q.Responses.DefaultIfEmpty()
        where q.PageNumber == page && r.UserId == userId
        select new Question 
        {
           Id = q.Id,
           QuestionType = q.QuestionType,
           Question1 = q.Question1
        }


This is my first MVC project and I am really struggling although I have followed several online tutorials. I would be grateful for any help.
AnswerRe: Cannot get ViewModel in MVC5 to work Pin
Mohamed Abdirahman19-Jan-14 1:08
professionalMohamed Abdirahman19-Jan-14 1:08 
Questionhow to use datalist control with button to redirect to that specific page Pin
Ravi900kumar17-Jan-14 2:13
Ravi900kumar17-Jan-14 2:13 
Questionwhich one is good for learning Window azure and sharepoint? Pin
NITIN GUPTA17-Jan-14 0:28
NITIN GUPTA17-Jan-14 0:28 
GeneralRe: which one is good for learning Window azure and sharepoint? Pin
Richard MacCutchan17-Jan-14 6:13
mveRichard MacCutchan17-Jan-14 6:13 
Question3D Scatter plots in ASP.Net Pin
Kandepu Rajesh15-Jan-14 21:32
Kandepu Rajesh15-Jan-14 21:32 
AnswerRe: 3D Scatter plots in ASP.Net Pin
thatraja15-Jan-14 22:49
professionalthatraja15-Jan-14 22:49 
QuestionGet the newest 15 messages Pin
Otekpo Emmanuel15-Jan-14 4:05
Otekpo Emmanuel15-Jan-14 4:05 
AnswerRe: Get the newest 15 messages Pin
Richard MacCutchan15-Jan-14 6:31
mveRichard MacCutchan15-Jan-14 6:31 
QuestionComplex XML Parsing Help!! I'm getting mad! Pin
Cristian Capannini14-Jan-14 23:47
Cristian Capannini14-Jan-14 23:47 
AnswerRe: Complex XML Parsing Help!! I'm getting mad! Pin
Bernhard Hiller15-Jan-14 22:12
Bernhard Hiller15-Jan-14 22:12 
QuestionAsp.net bank transfer Pin
Otekpo Emmanuel13-Jan-14 10:54
Otekpo Emmanuel13-Jan-14 10:54 
AnswerRe: Asp.net bank transfer Pin
Ron Beyer13-Jan-14 11:54
professionalRon Beyer13-Jan-14 11:54 
GeneralRe: Asp.net bank transfer Pin
Otekpo Emmanuel14-Jan-14 5:12
Otekpo Emmanuel14-Jan-14 5:12 
GeneralRe: Asp.net bank transfer Pin
Otekpo Emmanuel14-Jan-14 5:19
Otekpo Emmanuel14-Jan-14 5:19 
GeneralRe: Asp.net bank transfer Pin
Ron Beyer14-Jan-14 5:27
professionalRon Beyer14-Jan-14 5:27 
AnswerRe: Asp.net bank transfer Pin
jkirkerx14-Jan-14 13:49
professionaljkirkerx14-Jan-14 13:49 
GeneralRe: Asp.net bank transfer Pin
Otekpo Emmanuel14-Jan-14 16:31
Otekpo Emmanuel14-Jan-14 16:31 

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.