Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7667617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:09:06+00:00 2026-05-31T15:09:06+00:00

i am making an application called AskQuestion where in on the first page i

  • 0

i am making an application called AskQuestion where in on the first page i have a list of questions as links and below it is a textarea and a post button to post the question.
as i write inside the textarea and press the post button it is displayed inside the question list.
now i m fetching the posted questions from the database. and i need to display it as a link..
but Html.Actionlink does not support this

this is my Model class:

  public class Question_Page
{

    public virtual int Id { get; set; }
    public virtual string Question_name { get; set; }
    public virtual string Address { get; set; }
    public virtual DateTime Created_Date { get; set; }
    public virtual DateTime Modified_Date { get; set; }
    public virtual int Created_By { get; set; }
    public virtual int Modified_By { get; set; }
    public virtual char Deleted { get; set; }
    public Question_Page()
    {
        this.Deleted='F';
    }
}

This is my view:

@model IEnumerable<Core.Model.Question_Page>

@{
  ViewBag.Title = "Index";
 }
<style type="text/css">
ul
 {
    list-style-type: none;
 }
</style>

<h2>All Questions</h2>
<hr />

@using (Html.BeginForm("Index","Question",FormMethod.Post))
{
 @Html.ValidationSummary(true)
<ul>
foreach (var item in Model) {

    <li>@Html.ActionLink(item.Question_name, "answer", new { id=item.Id   })</li>
}
   </ul>
<label for="PostyourQuestion:">Post your Question:</label><br /><br />
 @Html.TextArea("textID")    

<br />
<input type="submit"/>
}   

But with this i get an error saying “item does not exists in the current context”

i know i can use anchor tag also before this and i tried that too

<ul>
foreach (var item in Model) {

   <li><a href="answer.cshtml">@Html.DisplayFor(modelItem => item.Question_name)</a></li>
}
</ul>

but with it does not identify the url specified in href

please help me

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:09:07+00:00Added an answer on May 31, 2026 at 3:09 pm

    I did a sample which looks like yours and I found out that you missed “@” before “foreach”

    @foreach (var item in Model) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an application usign MVC and LINQ. I have a controller called
Im making a multi activity application and the first two activities i made have
I am making an application with Java Swing and i have a problem. I
I'm making an application that contains button's and those buttons control an embedded browser.
I am making one application in which one webservices need to be called, is
I am making an android application in which I have put 10 images and
I am making a VOIP application for mobile platform. My question is what algorithms
I'm making an application that makes use of session variables. I have created a
I am making an application where i have set two bottom tabs, namely Exit
this is my first question on stack overflow but I have some experience in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.