One of my website fields, ProductName, contains a specific product name. Any logged-in user can update this product name by clicking on the text and hitting save.
I found the necessary code for this functionality at .
In my ASP.net VB setup, I have designated roles for admins and non-admins. I am interested in using JavaScript to restrict editing of the field to only admins.
Below is the Javascript code responsible for making the field editable:
$('.productName.edit').editable(function (value, settings) {
var ProductID = $('input#body_ProductID').val();
var result = SubmitProductName(ProductID, value);
return (value);
}, {
width: '350',
submit: 'Save Changes',
cancel: 'Cancel',
onBlur: 'ignore'
});
And here is the ASP representation of the field:
<asp:FormView ID="fvProduct" runat="server" DataSourceID="dsProduct">
<ItemTemplate>
<h1 class="productName edit"><%# Eval("ProductName")%></h1>
</ItemTemplate>
</asp:FormView>
I would appreciate any assistance on this matter. Thank you.