Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi friends

I'm new to Mvc 3 Razor engine, i have a question. If i have to 4 text boxes having 2 textboxes for firstname and 2 textboxes for second name.
FirstName: @Model.reser_fname
LastName: @Model.reser_lname
JavaScript
(modifyname)
FirstName: @Model.reser_fname 
LastName: @Model.reser_lname
(modifyname)
// script for popup box when the modify link is clicked
<script type="text/javascript">
$(document).ready(function () {
$('#modify').click(function () {
$("#dialog:ui-dialog").dialog("destroy");
$("#dialog-box").dialog({
buttons: {
"save": function () {
},
Cancel: function () {
$(this).dialog("close");
}}
});
});
});
</script>
// div inside the popup box
<div id-="dialog-box">

Edit Details
FirstName : <input type="text" id="reser_fname" />
LastName : <input type="text" id="reser_lname" />
this is on a confirmation page, where as per razor code i have the first name and last name, now if i want to edit the first and last name,i click modify and i get a popup box, which has firstname and lastname. I enter i the details and click save button inside the popup. So the details on the confirmation page should change. how is that i can write a code for that save button where it changes the details on my confirmation page.

can anyone help..
Posted
Updated 11-Oct-12 3:05am
v2

1 solution

Here is a high level implementation of what you needed. Modify as per your need ! You have already gotten halfway!!

http://jsfiddle.net/FTHRn/[^]

Hope this helps!
 
Share this answer
 
Comments
Member 9359591 12-Oct-12 10:44am    
Hey Karthik, thank you for the response.. Its working as html text but as i'm using razor, this is'nt working the first naem and last name are'nt changing..i tried couple of way but it is'nt working.. can you give me any other way..
Karthik. A 12-Oct-12 10:49am    
Sorry to hear that. Can you post the razor markup too, so that its easier for us to help? You just the jquery/jscript related to your page now... Especially , you have FirstName: @Model.reser_fname -- try changing it to a div and also add a hidden value. Something like this:

First name: <div id="fname">@Model.reser_fname</div>
<input type="hidden" id="modified-fname" />

Now on save you can modify both the fname div and the modified-fname hidden field so that the modified information can also be sent to the controller's action method. Elaborate on your qn. and one of us could help!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900