0

I build a web site with MVC4, and in my routeConfig file I have this procedure:

Public Sub RegisterRoutes(ByVal routes As RouteCollection)
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
    routes.IgnoreRoute("{resource}.aspx/{*pathInfo}")
    routes.IgnoreRoute("{resource}.aspx")
    default.aspx will load instead
    routes.MapRoute(
        name:="Default",
        url:="{controller}/{action}/{id}",
        defaults:=New With {.controler = "Home", .action = "Index", .id = UrlParameter.Optional}
    )
End Sub

In my HomeControler I have this function:

Function Index() As ActionResult
    Return View("Default")
End Function

Thus my Default.aspx is working just fine. But.
When I'm trying to click a button cannot Handle the onclick event (never goes to the sub.
So I use a OnClientClick in aspx to raise up this event.
But throws me the error of:

grFlagsBtn_Click' is undefined

And one more issue... I've noticed the program remains on Home/Index environment. Where there is no any Index file at this area.
But the Url in my browser says href="http://localhost:49224/Home/Index"
I found that very much strange, because the program should be in /Home/Default.. I think, I'm not of that.
Please is some one to give me some help on this?

11
  • I'm pretty sure mvc doesn't have server event like onclick it all has to do with the different route actions. Commented Feb 8, 2019 at 18:03
  • @ the_lotus So will never be able to handle the onclick event which is in asp.net ? Commented Feb 8, 2019 at 18:05
  • 1
    MVC is radically different in it's way of handling postback compared to winform. Even if both have the acronym ASP.NET in them. Commented Feb 8, 2019 at 18:07
  • @ the_lotus I choose MVC for better organize and better work. Now.. I don't know Commented Feb 8, 2019 at 18:09
  • 2
    Probably have a look at stackoverflow.com/q/102558/11683 and codeproject.com/Articles/575397/…. Commented Feb 8, 2019 at 18:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.