Hi,
I have a rating control on a page and a upload control. I am saving the files data into my database. I am using this handler to do this,
UploadProgressManager.Instance.AddFinishingUploadEventHandler("serverID1", new EventHandler<UploadFinishingEventArgs>(handler)); return View("MultipleUpload");
I need the value the user has selected on the rating control while I am processing my file how would I get this value?
Hi, Michael.
The igRating MVC helper has method called RatingFor(), and using it you will have the value automatically on the server. You can check Load And Save Rating Form Values sample to see how this is achieved and if you have more questions don't hesitate to ask them.
Best regards,
Nikolay
Hi Nikolay,
Thank you for the quick response. I have added RatingFor method;
Html.Infragistics().RatingFor(m => m.UserVote)
But when I try getting the value in the handler for the uploadfile it has no value. Does this have anything to do with the fact I am trying to get the value in the handler instead of on a post method?
Regards
Michael
Thanks for the interesting post.
Thank you for the feeback. I am using a post event now.
You are right that you can get the value that is coming from the RatingFor() method only in HttpPost action method. If you see the controller class in the same sample Load And Save Rating Form Values, more specifically 'PostRating' method, you will see that you need just to provide method parameter that is the rating, and MVC will transform 'behind the scenes' the client value coming from RatingFor() and will pass it as server parameter.
For your scenario it's seems that user has selected the value of the rating prior to uploading the file. This means that you can make a separate post to the server when the user make his rating. It can be either ajax or full postback, and on the server you can save the rating value in the session. Then in the 'AddFinishingUploadEvent' handler you can get the rating value from the session. I know this is not the best way to do this, especially when Session object is used with MVC, but I hope this will help to resolve your issue.
I'm here if you have more questions.
Thanks,