MVCContrib 网格覆盖 RowStart 和 RowEnd - 行开始和结束呈现在整个网格之上

发布于 2024-10-14 12:37:01 字数 2649 浏览 3 评论 0原文

好的,我正在使用 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 元素中)

问候, 詹姆斯

Ok so i'm using the MVCContrib grid trying to override the start of a row and the end of a row. It's not working as advertised. I'm reasonably sure it's me doing something silly.

This is an extract from my MVC2.0 view.

<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>

This is the resulting html...it's very weird:

<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>

The stuff i put in the begin row and end row functions is being rendered above the grid entirely. What the what?
I've been smacking my head over this one for a couple of hours can anyone see what i've done wrong?

(PS i can't just use the attributes as i need to wrap the row in another html element)

regards,
james

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪我闹别瞎闹 2024-10-21 12:37:01

我尝试做你所做的事情,生成的 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 的话。

I tried doing what you did, and the generated HTML was:

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

However the extra text all renders at the top of the grid, presumably because it's not contained within any child element.

To test what's happening, you could try:

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

However I'm not sure you actually can wrap the in another html element, at least if you want valid html.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文