Tutorial :How does openrasta work out the action for a page?



Question:

I currently have two routes configured:

      ResourceSpace.Has.ResourcesOfType()                    .AtUri("/patient")                    .And                    .AtUri("/patient/cardId/{cardId}")                    .HandledBy()                    .AsJsonDataContract()                    .And                    .RenderedByAspx("~/Views/Patient.aspx");                      ResourceSpace.Has.ResourcesOfType()                      .AtUri("/product")                      .And                      .AtUri("/product/tagValue/{tagValue}")                      .HandledBy()                      .AsJsonDataContract()                      .And                      .RenderedByAspx("~/Views/Product.aspx");    

When using this code

     using (scope(Xhtml.Form(Resource).ID("AddPatientForm").Method("post"))) {     

For patient it translate the action to

action="/patient"

and for product

action="/product/tagValue"

What am I doing wrong? Can I hint it, I had a quick look in the source and Action is a URI so I can't just set it via Action.

Any help would be appreciated!


Solution:1

For patient, if the Resource has a cardId it should select that URI first. If it doesn't, it's a bug.

For product, that's definitly a bug (unless your product class has a tagValue of null / empty) so please fill a bug report on the new bug tracker at http://youtrack.codebetter.com/issues/OR

In the meantime, you can simply do Xhtml.Form().Action(Resource.CreateUri()) if it has the properties set or Xhtml.Form().Action(Resource.CreateUri(new{ cardId = value });


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »