Click here to Skip to main content
15,667,864 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:

I am working on web application in MVC 3 using Visual Studio 3. and using sql server 2005 at the back end.
I am creating an account in data base using the HTTPPost method. Account creates successfully. and i get the AccountId of the created account.
Here is the code given below :
       public ActionResult Index(Account account)
          string accountId;
              Here is the code to create account using Linq, 
          account.AccountId = accountId;

          return View("Index", account);

I get the accountId as i checked in debugger and then i assign the accountId to account.AccountId property of the Account Model object.
The AccountId property is attached to text box in the view as given below.
@Html.TextBoxFor(x => x.AccountId);

But when the View is redrawn it still is showing the empty box. The view is a strongly typed view of Account Model class.

No please some one help me immediately where am i going wrong.

thanks in advance.

Please try is as below.
@Html.DisplayFor(x => x.AccountId)
Share this answer
<input type="text" value="@Model.AccountId" id="txt_accid" />
try this
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900