asp.net - passing parameters to .aspx page using renderpartial -
In my index.aspx page, I want to render partial by using renderpartial and render it to another module.aspx page. The parameter which is passed from index.aspx (this number is ie 1,2, so to call different .htm files at all times depending on the parameter)
1). Now I want the Index.aspx page module. Render the espx and pass it to the parameter (1,2,3, etc.) [the criteria will be programmatic (hardcod) and 2). Mudule.aspx should capture the parameter and depending on it, it will call the .htm file
my index.aspx
and <% ViewData ["TemplateId"] = 1; & Gt%; & Lt;% HTML. RenderPortal ("/ view / template / mime.sepx", seeData ["TemplateAdd"]); & Gt%;
and include module.aspx
& lt;% @ page language = "c #" inheritance = "system.web.mvc.ViewPage "% & Gt; & Lt; Script type = "text / javascript" src = "/ script / jquery-1.3.2.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "/ script / service.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Debugger; Var tid = '& lt;% = ViewData ["TemplateId"]% & gt;'; $ .get ("/ Templates / Select /" + tid, function (result) {$ ("# datashow"). Html (results);}); & Lt; / Script & gt; & Lt; Div id = "datashow" & gt; & Lt; / Div & gt;
This is my controller that $ .get (....) (see code)
Contact public action (id id) return file ("/ Visual / template / HTML_Temp" + id.ToString () + ".htm", "text / html"); }
and finally my .htm file
& Lt; / P & gt; & Lt; P & gt; Event details: & lt; Input type = "text" id = "description" value = "{{description}}" read-only = "readable" style = "width: 312 px" /> gt; & Lt; / P & gt; & Lt; P & gt; Event date: & lt; Input type = "text" id = "date" value = "{{date}}" reading = "readable" style = "width: 251px" /> gt; & Lt; / P & gt; & Lt; P & gt; Keywords: & lt; Input type = "text" id = "keyword" value = "{{keyword}}" Read-only "=" reading ">> & lt; / div & gt; Lt; script type = "text / javascript"> Sys.Application.add_init (appInit); function in INIT () {start ();}
< P> start () is the JavaScript method that is in the file. Service.js When I run this program, I get an error js runtime error: 'Required object' and debugger
< Pre> & lt ;! DOCTYPE HTML Public Highlighted - - / / W3C // DTD XHTML 1.0 Stronger // n "" http://www.w3.org/TR/xhtml1/DTD/ ** XHTML ** 1-strict.dtd "& gt;
pls help me fix the problem
Use & lt;% HTMLRenderPartial ("/view / templates / mime.execs", model); %
using a model to pass values in a partial view MyModule.ascx. You can also use the Html.RenderAction method
Comments
Post a Comment