This is a migrated thread and some comments may be shown as answers.

Unable to add radio buttons to Kendo UI grid popup

14 Answers 671 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fred
Top achievements
Rank 1
Fred asked on 20 Feb 2013, 04:15 PM

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.


14 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 22 Feb 2013, 10:42 AM
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!
0
Fred
Top achievements
Rank 1
answered on 22 Feb 2013, 09:31 PM
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>

0
Fred
Top achievements
Rank 1
answered on 25 Feb 2013, 04:32 PM
the version number of kendo on my project is 2012.3.1114.340. Is this a issue?


0
Dimiter Madjarov
Telerik team
answered on 25 Feb 2013, 05:11 PM
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!
0
Fred
Top achievements
Rank 1
answered on 26 Feb 2013, 03:32 AM
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
0
Dimiter Madjarov
Telerik team
answered on 27 Feb 2013, 01:09 PM
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!
0
Fred
Top achievements
Rank 1
answered on 28 Feb 2013, 09:55 PM
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
0
Fred
Top achievements
Rank 1
answered on 04 Mar 2013, 05:57 PM
How to use the sync event of datasource, when it will be triggered? This is a hurry question, thank you.

0
Daniel
Telerik team
answered on 04 Mar 2013, 06:47 PM
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!
0
Fred
Top achievements
Rank 1
answered on 04 Mar 2013, 09:14 PM
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
0
Daniel
Telerik team
answered on 06 Mar 2013, 08:53 PM
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!
0
Fred
Top achievements
Rank 1
answered on 07 Mar 2013, 03:35 PM
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
0
Daniel
Telerik team
answered on 08 Mar 2013, 03:48 PM
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!
0
Fred
Top achievements
Rank 1
answered on 08 Mar 2013, 09:28 PM
Thank you for your answers. It is working right now. We updated the kendo UI to new version. Then requestEnd is able to triggered
Tags
Grid
Asked by
Fred
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Fred
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or