Hi I am trying to get the inPlace editing functionality. But this time its in Master page of an ASP.net application. I have a label control (for title of each web page) on master page. And in my content page I want to allow user to edit that title.
Scenario is that Label should be converted to textbox when user click label. edit and then when textbox will loose focus, it should be converted to updated label. I don't want to change my master page contents. Otherwise may be I can add a hidden textbox on masterpage to replace it with label. But my concern is that Can I do this without editing my master page? I tried to work with JQuery .replaceWith()
method. But I am new to JQuery and asp.net. Please help me thanks.
<script type="text/javascript" src="../Scripts/jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="../Scripts/jquery-1.3.2.min.js" ></script>
<script type="text/javascript" src="../Scripts/jquery/jeditable.js" charset="utf-8"> </script>
<script type="text/javascript">
$(document).ready(function() {
$(".click").editable("~/AdminArea/Setup/SetupFixedText.aspx", {
tooltip: "Click to edit...",
style: "inherit"
});
});
</script&开发者_StackOverflow社区gt;
And in aspx I have a label first I assigned calss to label but now have placed label in "b"
div id = 'lblcontent'
h3 class="BlueHeading"
b class="click" style="display: inline"
asp:Label ID="lblContentTitle" runat = "server" EnableViewState="False"
/asp:Label
/b
/h3
/div
I removed angle brackets as this editor takign it as html.
For InPlaceEditing with jQuery, you should check out this plugin...
http://www.appelsiini.net/projects/jeditable
Should make things a lot easier
EDIT Given Posted Code
Change your aspx page to this:
<div id='lblcontent'>
<h3 class="BlueHeading">
<b style="display: inline">
<asp:Label ID="lblContentTitle" runat="server" CssClass="click" EnableViewState="False"></asp:Label>
</b>
</h3>
</div>
精彩评论