MVC and HTML 5 - Need code explanations [Resolved]

Posted by Allemahesh under ASP.NET MVC on 10/8/2015 | Points: 10 | Views : 1471 | Status : [Member] [MVP] | Replies : 4
I am new to MVC and HTML 5. In the projet, I saw the below line of cdoe.

<button class="btn btn-deault" onclick="-t('Home', 'Register', '');" href='#' taret="_blank" data-method="get" data-action="@Url.Action("Register", "Acount")" data-container="#modal"> Register</button>


I am not able to usederstand what this actualy doing. Also that the below tag are ment for.

1. data-method
2. data-action
3. data-container

If any one can explane this line of code and the tags.




Responses

Posted by: Sheonarayan on: 10/8/2015 [Administrator] HonoraryPlatinum | Points: 50

Up
3
Down

Resolved
The code you have copy-pasted is not complete code however whatever is written based on that

1. data-method - tell that when the button is clicked which method to use to submit the data (get/post/put etc). In this case it is get

2. data-action - when the button is clicked where to submit the data. In this case it would submit to /Register/Acount/ url

3. data-container - probably tells that when the response comes from server where to put it. This might be the id of the html element.

Looks like taret is wrong attribute it should be target that means that when the button will be clicked it will use a new tab to submit the data on the server.

class attribute is simply the bootstrap class for the button.

Hope this helps.

Thanks


Regards,
Sheo Narayan
http://www.dotnetfunda.com

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sheonarayan on: 10/8/2015 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved
In ASP.NET MVC, if your code looks like
Url.Action("Register", "Acount")
then your controller is Acount and action method is Register.

Read more about Url.Action at http://techfunda.com/Howto/asp-net-mvc/251/get-url-of-action-method .

Thanks and hope this helps.

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 10/8/2015 [Member] [MVP] Silver | Points: 25

Up
0
Down
Thank you for your response. It has given me some idea what all about this. I need to understand when I click on submit button, it will opening the pop up window and then it has a form.
Now I am not able to find which whindow it is opening. In the /Register/Acount/ url, where is the register and account. Can I say register is my control and acount is my action method?

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 10/14/2015 [Member] [MVP] Silver | Points: 25

Up
0
Down
Thanks. It is very helful

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response