passing parameters to .aspx page using renderpartial
        Posted  
        
            by dexter
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by dexter
        
        
        
        Published on 2009-12-07T05:03:51Z
        Indexed on 
            2010/03/30
            6:03 UTC
        
        
        Read the original article
        Hit count: 939
        
in my index.aspx page i want to render another module.aspx page using renderpartial which then render a .htm file depanding on which parameter is passed from index.aspx (it would be number ie 1,2 etc ,so as to call different different .htm file everytime depending on the parameter)
1). now i want Index.aspx page to render module.aspx and pass it a parameter(1,2,3,etc) [the parameters would be passed programatically (hardcoded)] and 2). mudule.aspx should catch the parameter and depending on it will call .htm file
my index.aspx has
  <% ViewData["TemplateId"] = 1; %>
  <% Html.RenderPartial("/Views/Templates/MyModule.aspx", ViewData["TemplateId"]); %>
and module.aspx contains
 <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<script type="text/javascript" src="/Scripts/jquery-1.3.2.js"></script>
<script type="text/javascript" src="/Scripts/Service.js"></script> 
<script type="text/javascript">
        debugger;
        var tid = '<%=ViewData["TemplateId"] %>';
        $.get("/Templates/Select/" + tid, function(result) {
            $("#datashow").html(result);
        });
</script>
<div id="datashow"></div>
this is my controller which is called by $.get(....) (see code)
public ActionResult Select(int id)
    {
        return File("/Views/Templates/HTML_Temp" +id.ToString()+".htm" , "text/html");
    }
and finally my .htm file
<div  id="divdata" class="sys-template">
<p>Event Title:<input  id="title"  size="150" type="text" 
        style="background-color:yellow;font-size:25px;width: 637px;"  
        readonly="readonly" value="{{title}}" />
    </p>   
<p>Event Description:<input type="text" id="description" value="{{ description }}"  
    readonly="readonly" style="width: 312px" /></p>
<p>Event Date: <input type="text" id="date" value="{{ date }}" readonly="readonly" 
        style="width: 251px"/></p>
<p>Keywords : <input type="text" id="keywords" value="{{keywords}}" readonly="readonly" /></p>
   </div>
<script type="text/javascript">
    Sys.Application.add_init(appInit);
    function appInit() {
        start();
    }
</script>
start() is javascript method which is in file Service.js
when i run this programm it gives me error js runtime error: 'object expected' and debugger highlighted on
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/**xhtml**1-strict.dtd">
pls help me solve the problem
© Stack Overflow or respective owner