如何在 Kendo Grid 中获取 objec 并将其传递到 gridrow 中的按钮

发布于 2025-01-03 05:29:42 字数 1824 浏览 5 评论 0原文

我正在尝试将一个按钮放入网格中。为了实现这一点,我想使用 rowTemplates。但是,我在获取项目 id 并将其放入操作参数中时遇到问题。 到目前为止,我尝试了这些构造函数,

<script id="rowTemplate" type="text/x-kendo-tmpl">
                <tr>
                    <td>
                    <form action="/Home/EditProduct/?id="+ "#=Id#" class="addEditButton" method="post">
                        <submit type="button" value="Edytuj"/>
                    </form>
                      </td>
                </tr>
    </script>

<script id="rowTemplate" type="text/x-kendo-tmpl">
                <tr>
                    <td>
                    <form action="/Home/EditProduct/?id="+ ${ Id } class="addEditButton" method="post">
                        <submit type="button" value="Edytuj"/>
                    </form>
                      </td>
                </tr>
    </script>

<script id="rowTemplate" type="text/x-kendo-tmpl">
                <tr>
                    <td>
                    <form action="/Home/EditProduct/?id=${ Id }"  class="addEditButton" method="post">
                        <submit type="button" value="Edytuj"/>
                    </form>
                      </td>
                </tr>
    </script> 

<script id="rowTemplate" type="text/x-kendo-tmpl">
                <tr>
                    <td>
                    <form action="/Home/EditProduct/?id=${ Id }  class="addEditButton" method="post">
                        <submit type="button" value="Edytuj"/>
                    </form>
                      </td>
                </tr>
    </script>

但是此方法无法成功从绑定到行的对象中检索 id 参数的值。是否有可能以某种方式将 id 的值传递给行动?

I'm trying to put a button into grid. In order to achieve that I wanted to use rowTemplates. However I have a problem with geting and item id and put it into action parameter.
So far I tried these constructinos

<script id="rowTemplate" type="text/x-kendo-tmpl">
                <tr>
                    <td>
                    <form action="/Home/EditProduct/?id="+ "#=Id#" class="addEditButton" method="post">
                        <submit type="button" value="Edytuj"/>
                    </form>
                      </td>
                </tr>
    </script>

<script id="rowTemplate" type="text/x-kendo-tmpl">
                <tr>
                    <td>
                    <form action="/Home/EditProduct/?id="+ ${ Id } class="addEditButton" method="post">
                        <submit type="button" value="Edytuj"/>
                    </form>
                      </td>
                </tr>
    </script>

<script id="rowTemplate" type="text/x-kendo-tmpl">
                <tr>
                    <td>
                    <form action="/Home/EditProduct/?id=${ Id }"  class="addEditButton" method="post">
                        <submit type="button" value="Edytuj"/>
                    </form>
                      </td>
                </tr>
    </script> 

<script id="rowTemplate" type="text/x-kendo-tmpl">
                <tr>
                    <td>
                    <form action="/Home/EditProduct/?id=${ Id }  class="addEditButton" method="post">
                        <submit type="button" value="Edytuj"/>
                    </form>
                      </td>
                </tr>
    </script>

However non of this method can successfully retrieve value of id parameter from object bounded to row. Is it possible to somehow pass value of id into action ??

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文