Unable to add radio buttons to Kendo UI grid popup

15 posts, 0 answers
  1. Fred
    Fred avatar
    9 posts
    Member since:
    Feb 2013

    Posted 20 Feb 2013 Link to this post

    I'm trying to have a group of 2 radio buttons (each button in different column but the same row) in my Kendo grid popup template but without success. I defined the type of the parameter as a string. But after clicking the radio button, it will set it to null type.

     It works fine with checkboxes, though

    <div class="editor-field">
                @Html.RadioButtonFor(model => model.Status, "Avail")Available
                @Html.RadioButtonFor(model => model.Status, "Not Avail") Not Available
    </div>

    when I debuged, model.Status = null,  every time.


  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2284 posts

    Posted 22 Feb 2013 Link to this post

    Hello Fei,

    Since you used check-boxes before, I am assuming that the actual type of the Status property is bool. If that is the case you should set the values of the radio buttons to true and false.

    E.g.

    <div class="editor-field">
        @Html.RadioButtonFor(model => model.Status, "true")Available
        @Html.RadioButtonFor(model => model.Status, "false") Not Available
    </div>

    I am also attaching a sample project to demonstrate the implementation. Please let me know if it covers the current scenario.
      Kind regards,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Fred
    Fred avatar
    9 posts
    Member since:
    Feb 2013

    Posted 22 Feb 2013 Link to this post

    Hi, Dimiter:

    Thank you for your reply. I check your project , it works fine, But when on my project , I don't know why it doesn't work

    In the attched picture , you can see the first entry in the grid view. PIDX column is true, but in the popup the PIDX radio button is No,  I cannot figure out this issue. Could you give me some suggestions?

    Thank you

    the code with issue
    <div class="editor-row">
            <div class="selector-type-column"> </div>
            <div class="float-left editor-label" style="width: 80px;">
                @Html.LabelFor(model => model.IsPidx)
            </div>
            <div class="editor-field">
                @Html.RadioButtonFor(model => model.IsPidx,"true")Yes
                @Html.RadioButtonFor(model => model.IsPidx,"false")No
                 <span  style="color:red">*</span>
            </div>
            <div class="clear"></div>
        </div>
    Originally here no issue with checkbox.
    <div class="selector-type-column"> </div>
            <div class="float-left editor-label" style="width: 80px;">
                @Html.LabelFor(model => model.IsPidx)
            </div>
            <div class="editor-field">
                @Html.CheckBoxFor(model => model.IsPidx) <span  style="color:red">*</span>
            </div>

  4. Fred
    Fred avatar
    9 posts
    Member since:
    Feb 2013

    Posted 25 Feb 2013 Link to this post

    the version number of kendo on my project is 2012.3.1114.340. Is this a issue?


  5. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2284 posts

    Posted 25 Feb 2013 Link to this post

    Hello Fei,

    There are no errors in the code that you attached. Could you modify my solution to reproduce the issue or send me a copy of your project, so I could test it locally and assist you further?
     
    The version should not be an issue in the current scenario.

    Kind regards,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. Fred
    Fred avatar
    9 posts
    Member since:
    Feb 2013

    Posted 25 Feb 2013 Link to this post

    Thank you. I will post it later. Another question , How to add a confirm message after insert or delete an entry in data grid? either succeed or fail
  7. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2284 posts

    Posted 27 Feb 2013 Link to this post

    Hello Fei,

    The default behavior of the Grid is to display a confirmation window when deleting a record. If you also want to display it when inserting or updating a record, you could bind to the save event of the grid and do it in the event handler.

    If you are referring to a window with a success (or error) message after the corresponding operation is over, you should handle the sync and error events of the dataSource. 

     

    Kind regards,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  8. Fred
    Fred avatar
    9 posts
    Member since:
    Feb 2013

    Posted 28 Feb 2013 Link to this post

    Thanks for your answers, could you send me a sample project to show me how to use error and sync event to display success and error message
  9. Fred
    Fred avatar
    9 posts
    Member since:
    Feb 2013

    Posted 04 Mar 2013 Link to this post

    How to use the sync event of datasource, when it will be triggered? This is a hurry question, thank you.

  10. Daniel
    Admin
    Daniel avatar
    2219 posts

    Posted 04 Mar 2013 Link to this post

    Hello Fei,

    Sorry, for the confusion. The sync event will be triggered even when there is a problem with the operation. Instead I can suggest to use the requestEnd event. I attached a sample project which demonstrates one possible implementation.

    Kind regards,
    Daniel
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  11. Fred
    Fred avatar
    9 posts
    Member since:
    Feb 2013

    Posted 04 Mar 2013 Link to this post

    Thank you, but in my project 
    .DataSource(dataSource => dataSource
                                         .Ajax()
                                         .Events(e =>
                                         {
                                             e.RequestEnd("requestEnd");
                                             e.Error("onError");
                                         })
     
     .Read(reader => reader.Action("Read", "MaterialCodeMapping").Data("getSearchCriteria"))
                                          .Create(reader => reader.Action("Create", "MaterialCodeMapping"))
                                          .Update(reader => reader.Action("Update", "MaterialCodeMapping"))
                                          .Destroy(reader => reader.Action("Destroy", "MaterialCodeMapping"))
                                          .Model(model =>
                                              {
                                                  model.Id(row => row.Id);
                                                  model.Field(row => row.TerminalId).DefaultValue(0);
                                              }))
           )
    RequestEnd is not triggered after Creating(adding) a new entry
  12. Daniel
    Admin
    Daniel avatar
    2219 posts

    Posted 06 Mar 2013 Link to this post

    Hello Fei,

    Could you check what is the response from the server when creating a record? The event will not be triggered if there is an exception.

    Kind regards,
    Daniel
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  13. Fred
    Fred avatar
    9 posts
    Member since:
    Feb 2013

    Posted 07 Mar 2013 Link to this post

    I am using the old version of kendo ui for asp.net mvc VSExtensions.
    . It's 2012.3.1114.0. I think that's the issue. I just check your app and my. the property of events of two versions are different
  14. Daniel
    Admin
    Daniel avatar
    2219 posts

    Posted 08 Mar 2013 Link to this post

    Hi,

    I tested the sample with the specified version but the event seems to be triggered correctly on my side. Could you check the attached updated project and let me know if I am missing something?
    Also, does updating to the service pack(2012.3.1315) resolves the problem on your side?

    Kind regards,
    Daniel
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  15. Fred
    Fred avatar
    9 posts
    Member since:
    Feb 2013

    Posted 08 Mar 2013 Link to this post

    Thank you for your answers. It is working right now. We updated the kendo UI to new version. Then requestEnd is able to triggered
Back to Top