tags:

views:

28

answers:

2

Hello All,

I want to take two html helpers textboxes on my master page please tell me what shall I do.I want to pass the value in the textboxes from the controller class.Please tell me how can I do that.

Thank You Ritz

A: 

Create a user control instead that contains the text boxes. Then on your master page, include the user control. That way in your controller you're still able to pass values to it through ViewData.

Agent_9191
thanks Agent_9191.Thank You
Ritz
A: 

Assuming ASP.NET MVC:

In your controller you can do the following:

public ActionResult Index() {
  ViewData["YourText"] = "Hello!";
  return View();
}

Your page:

<%= Html.TextBox("NameOfTextBox", ViewData["YourText"]);
Josh Barker