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

[Solved] Insert Only Field

2 Answers 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris
Top achievements
Rank 1
Chris asked on 07 Jun 2010, 03:22 PM
Hi,
    I'm trying to make a datakey field that can only be modified when the user clicks on the "Add New Record" button.  If the user clicks on the "Edit" button, then the field would be read only.  Is this possible?

I was considering capturing the click event of the "Edit" button and disabling the datakeys corresponding textbox...

Sorry if this is already in the forums somewhere, I was unable to find an example like it.

Thanks,
Chris

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 07 Jun 2010, 04:31 PM
Hello Chris Kidd,

You can try this (if using ajax editing/binding):
<% Html.Telerik().Grid<T>()
                 .ClientEvents(events => events.OnLoad("onLoad"))
%>
    <script type="text/javascript">
    function onLoad() {
        $('.t-grid-edit', this).live('click', function(e) {
            setTimeout(function() {
                $('#Grid .t-edit-form #ProductName').hide();
            }, 0)
        });
    }
    </script>

Replace "Grid" and "ProductName" in the onLoad JavaScript routine with the name of your grid and bound field you want to hide.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Chris
Top achievements
Rank 1
answered on 07 Jun 2010, 05:31 PM
Thanks, that worked.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Chris
Top achievements
Rank 1
Share this question
or