Reputation: 787
Can I create a server control, where it loads as a label and on user click becomes a text box with two buttons(save,cancel) on the bottom right corner and then on pressing save becomes a label again with the entered text or cancel will cancel the edit(if any) and becomes a label again with the existing text?
Upvotes: 0
Views: 40
Reputation: 1934
I have created a JSfiddle for the same:-
Code:-
$(function() {
$("#lbl").click(function() {
var text = $("#lbl").text();
$("#lbl").hide();
$("#edit").show();
$("#text").val(text);
});
$("#save").click(function() {
//make call to server if you want to save the value in DB
var text = $("#text").val();
$("#lbl").text(text);
$("#edit").hide();
$("#lbl").show();
});
$("#cancel").click(function() {
$("#edit").hide();
$("#lbl").show();
});
});
in Save button event you can make ajax call or whatever you want to do...
Upvotes: 1
Reputation: 3495
visible
property visible=true OR visible=false
asp
controls have visible
property - More information for visible propertyUpvotes: 0