FlexGrid CollectionViewItemResult error message

Posted by: info on 3 October 2017, 3:55 am EST

  • Posted 3 October 2017, 3:55 am EST

    Hi,
    when an error occurs with the Create, Update, or Delete methods, you receive a alert that show the error message.
    It would be possible to hide the alert and display that error, not in grid but in html, for example in a div?

    Eg:
                <div id = "show_error" class = "error"> # error message </ div>

                @ (Html.C1 (). FlexGrid (). Id ( "data_grid")
                      .SelectionMode (SelectionMode.Row)
                      .AllowSorting (true)
                      .Filterable ()
                      .Height (450)
                      .Bind (b =>
                      {
                          b.Bind (Url.Action ( "RemoteBind_Read"));
                          b.Create (Url.Action ( "GridCreate"));
                          b.Update (Url.Action ( "GridUpdate"));
                          b.Delete (Url.Action ( "GridDelete"));
                      })
                      .AutoGenerateColumns (false)
                      .Columns (bl =>
                      {
                          bl.Add (cb => cb.Binding ("Id"). Visible (false));
                          bl.Add (cb => cb.Binding ("Note"). Width ("*") IsReadOnly (true));
                      })
                      .ItemFormatter ( "gridFormatter"))

    Thank's,
    Marco
  • Replied 5 October 2017, 6:12 am EST

    Hi Marco,
    If we are correct, you are using BuiltInValidation same as given below sample.
    http://demos.componentone.com/ASPNET/MVCExplorer/FlexGrid/BuiltInValidation

    If yes, you can set showErrors to false which will stop highlights error. Now, you need to create a method which will return the message for given cell. This method should be called in beginningEdit method and show the message in Div specified by you.

    You need to handle cellEditEnding event to keep the cell in edit mode if the cell new value is invalid.

    Thanks,
    Manish Kumar Gupta

  • Replied 5 October 2017, 11:25 pm EST

    Hi Marco,
    You need to handle these events using client or use <a href="http://helpcentral.componentone.com/nethelp/c1mvchelpers/C1.Web.Mvc~C1.Web.Mvc.FlexGridBase%601~OnClientBeginningEdit.html">onClientBeginningEdit</a> and <a href="http://helpcentral.componentone.com/nethelp/c1mvchelpers/C1.Web.Mvc~C1.Web.Mvc.FlexGridBase%601~OnClientCellEditEnding.html">onClientCellEditEnding</a>.

    Thanks,
    Manish Kumar Gupta

Need extra support?

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

Learn More

Forum Channels