Arkadiusz Raszeja Arkadiusz Raszeja - 1 year ago 90
HTML Question

getting value of input text from html to mvc

I have textbox containing the url. In html it looks like this:

<input id="BannerLink1" name="BannerLink1" type="text" value="@ViewBag.baner1_link" />

I'm trying to get this value to controller using Request object:

baner.Url_link = Request["BannerLink1"];

But my controller always see
as empty string. Any guesses what can be wrong?

Answer Source

You need to put your input-tag inside form tags (Html.BeginForm()) to put the value when the form posts.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download