I dont know how get value in Razor

Mar 12, 2012 at 3:02 PM

Hi folks. first I say Great Work and thanks.

I'm newbie in web programming (my specialty is desktop app) Im programming right now a web in ASP.NET MVC 3 with Razor engine.

I need get the value of the rated. For example:

in my view 

<div class="rateit" data-rateit-resetable="false" data-rateit-step="1.0" ????????what else?????????? ></div>\
and in my controller:
public ActionResult TicketRating(????????)
	decimal rate = ?????????;
	//then save my Var rate in SQL.
	return View();
Thanks very much and Im sorry for my english.
Mar 12, 2012 at 3:17 PM
Edited Mar 12, 2012 at 3:22 PM

Ok, I get value this way: is the better????

<div class="rateit" data-rateit-resetable="false" data-rateit-step="1.0" data-rateit-backingfld="#RateTime"></div>
@Html.TextBox("RateTime", "")
//-- controller --//
public ActionResult TicketRating(string Feedback, int RateTime)
	string s = Feedback;
	int r = RateTime;
	return View();

Mar 12, 2012 at 3:47 PM

That shows indeed one way of working with it (just change your @Html.TextBox() to @Html.Hidden() )

On the example page, there is a ASP.NET webforms example, that uses ajax (without a backing field)


In that case, your action would have two parameters , id and value, and you would change the url in the Ajax method to your action. (@Url.Action())