【问题标题】:MVCContrib Grid Overriding RowStart and RowEnd - The Row start and end are rendered above the entire gridMVCContrib Grid Overriding RowStart 和 RowEnd - Row start 和 end 呈现在整个网格之上
【发布时间】:2011-01-26 14:08:25
【问题描述】:

好的,所以我正在使用 MVCContrib 网格尝试覆盖行的开头和行的结尾。它不像宣传的那样工作。我有理由确定是我在做傻事。

这是我的 MVC2.0 视图的摘录。

<div id="chargestable">
<br />
<%  With Html.Grid(Model.InvoiceListingInformation)
        .Columns(Function(column)
                     column.For(Function(setColumns) setColumns.InvoiceNumber)
                     column.For(Function(setColumns) setColumns.InvoiceDate)
                     column.For(Function(setColumns) setColumns.ExclGST)
                     column.For(Function(setColumns) setColumns.InclGST)
                 End Function)
        .RowStart(Function(pRowStart) "Some extra text here <tr>")
        .RowEnd(Function(pRowEnd) "</tr>")
        .Render()

    End With
   %>
</div>

这是生成的 html...这很奇怪:

<div id="chargestable">
    <br>
    Some extra text here text/Some extra text here Some extra text here text/Some extra text here Some extra text here text/Some extra text here Some extra text here text/Some extra text here Some extra text here text/Some extra text here Some extra text here text/Some extra text here 
<table class="grid">
<thead>
<tr><th>Invoice Number</th><th>Invoice Date</th><th>Excl G S T</th><th>Incl G S T</th></tr>
</thead>
<tbody>
<tr><td>x</td><td>13/12/2009 12:00:00 AM</td><td>amnt</td><td>amnt</td></tr>
<tr><td>y</td><td>15/11/2009 12:00:00 AM</td><td>amnt</td><td>amnt</td></tr>
<tr><td>z</td><td>13/10/2009 12:00:00 AM</td><td>amnt</td><td>amnt</td></tr>
<tr><td>a</td><td>13/09/2009 12:00:00 AM</td><td>amnt</td><td>amnt</td></tr>
<tr><td>b</td><td>13/08/2009 12:00:00 AM</td><td>amnt</td><td>amnt</td></tr>
<tr><td>c</td><td>12/07/2009 12:00:00 AM</td><td>amnt</td><td>amnt</td></tr>
<tr><td>d</td><td>13/06/2009 12:00:00 AM</td><td>amnt</td><td>amnt</td></tr>
<tr><td>e</td><td>13/05/2009 12:00:00 AM</td><td>amnt</td><td>amnt</td></tr>
</tbody>
</table>
</div>

我在开始行和结束行函数中放置的内容完全呈现在网格上方。什么什么? 我已经为这个问题打了几个小时,谁能看出我做错了什么?

(PS 我不能只使用属性,因为我需要将行包装在另一个 html 元素中)

问候, 詹姆斯

【问题讨论】:

    标签: vb.net asp.net-mvc-2 mvccontrib mvccontrib-grid


    【解决方案1】:

    我尝试做你所做的,生成的 HTML 是:

    ...
    <tbody>
    Some extra text here <tr>...</tr>
    Some extra text here <tr>...</tr>
    ...
    

    但是,额外的文本全部呈现在网格的顶部,大概是因为它不包含在任何子元素中。

    要测试发生了什么,您可以尝试:

     .RowStart(Function(pRowStart) "<tr>extra row here</tr><tr>")
    

    但我不确定你是否真的可以将 html 元素包装在另一个 html 元素中,至少如果你想要有效的 html 的话。

    【讨论】:

      猜你喜欢
      • 2019-08-08
      • 1970-01-01
      • 2021-06-19
      • 2023-01-31
      • 2020-12-01
      • 2012-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多