How to set focus on controls inside TabPage in DevExpress MVC tabpage?

342 views Asked by At

I am using DevExpress MVC for my application.In that I am using three TabPages.The content of the Tab Pages are in different Partial Views.My Question is How to set focus on controls in each tab page when the tab page is clicked?

1

There are 1 answers

0
Adrian Tarnowski On

You can try it with Html.RenderAction. For example:

@Html.DevExpress().PageControl(
settings =>
{
    settings.Name = "myTabs";
    settings.CallbackRouteValues = new { Controller = "Tabs", Action = "CallbackTabs" };

    settings.TabPages.Add("Tab1").SetContent(() =>
    {
        ViewContext.Writer.Write("<div class='tab1Content'>");
            Html.RenderAction("GetTab1", "Tabs");
        ViewContext.Writer.Write("</div>");
    });
    settings.TabPages.Add("Tab2").SetContent(() =>
    {
        ViewContext.Writer.Write("<div class='tab1Content'>");
            Html.RenderAction("GetTab2", "Tabs");
        ViewContext.Writer.Write("</div>");
    });
}

And controller actions:

    public ActionResult GetTab1()
    {
        return PartialView("_Tab1", result);
    }

    public ActionResult GetTab2()
    {
        return PartialView("_Tab2", result);
    }