hi Mark and Vino2012,
Thank you for your support in solving this issue.I guess your's,Vino2012 and my team member's help made me achieve the goal.I have given the description of what the problem was.
Step1:
My team member suggested me to use a partialview and put it on the page using @HTML.Partial()
So I have done that and put the page which is being called as URL inside the index.cshtml.This page was placed inside a div tag and I hid the div tag on document.ready().
Step 2:
I have loaded the div into the dialog and displayed the page inside the dialog.On the page I have written the following code in jQuery on the button click
<script type="text/javascript">
$(document).ready($(function () {
$("#btnSearch").button().live("click", function() {
$(document).ready($(function() {
$("#modalSearch").dialog('close');
}));
});
}));
</script>
and it worked.Thanks to vino2012 for suggesting to use $(document).ready to achieve this.
I would not be able to select any single answer as the correct one as it is a mix of suggestion,so please forgive me for not selecting the right answer.