使用ASP.NET MVC 2.0进行部分视图渲染

时间:2011-02-22 19:09:22

标签: asp.net asp.net-mvc-2

我有一个包含TextArea的局部视图。 当我在主视图页面中渲染此parital视图时,文本区域将被禁用(但它不会变灰)并且不允许在那里键入任何条目。

//---Here are the code segement from my partial view---

<div id="AddComment" style="display:none">
      <fieldset>
          <legend>Add Comment</legend> 
          <p><label> Comment for:</label>- <select id="Station"></select></p>
          **<%=Html.TextArea("UserComment", new { rows = 5, cols = 65})%>**** (this text area is  the problem)
          <p><input type="button" id="addComment" onclick="SaveComment()" value="Save" /></p>
      </fieldset> 
 </div>
//-----end of code segment -----------------------

请帮忙

提前致谢。

1 个答案:

答案 0 :(得分:0)

我解决了探测问题。它不是部分视图Rendering.it的错误,它基本上是在主页面上编写的脚本来阻止退格键。

// --------------------下面的代码行阻止浏览器在编辑器--- // //文档外面按下退格键。 attachEvent('onkeydown',function(evt){evt.returnValue = false;}); // ------------------------------------------------ ----------------------------------- // ...

一旦我删除了这一行,就开始工作了。谢谢大家帮助我