Focus on AddNewRow in FlexGrid Asp.Net MVC

Posted by: harunshaban on 28 November 2019, 11:55 pm EST

  • Posted 28 November 2019, 11:55 pm EST

    While testing FlexGrid, stack in a problem.
    Created sample data and retrieved successful, by creating new C1 Scaffolder.


    @(Html.C1().FlexGrid<TestComponentOne.Models.Data>()
    .AllowAddNew(true).AllowDelete(true).AutoGenerateColumns(false)
    .Columns(csb =>
    {
    csb.Add().Visible(false).Binding("id");
    csb.Add().Binding("f_name").Header("Name").Width("193");
    csb.Add().Binding("l_name").Header("Surname").Width("193");
    csb.Add().Binding("email").Header("Email").Width("500");
    csb.Add().Binding("gender").Header("Gender").Width("200");
    })
    .Filterable()
    .Bind(cvsb => cvsb.MoveToPage(100).PageSize(25).BatchEdit(Url.Action("DataFlexGrid_BatchEdit")).Bind(Model))
    .Width("100%")
    .Height("500px").Id("dataFlexGrid"))
    @(Html.C1().Pager()
    .Owner("dataFlexGrid"))


    As you can see I have check the property to allow new record directly from grid.
    So the problem is I want as soon as user opens the webpage where the grid is located user directly to add new record from keyboard, not to touch mouse to select the row and start to add record.
    Tried with some kind of focus method and selected row property but it did not work...
    Also searched in official documentation and there were no such kind of property or information..
    Is there any kind of solution for the problem?
  • Replied 29 November 2019, 12:29 am EST

    Hi,
    You may set the newRowAtTop property to true and focus the FlexGrid as the page gets loaded to start editing by calling the focus() method.

    Hope it helps!

    Regards,
    Manish Gupta


Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels