WebGrid 的标头格式
我刚刚读过: http://www.mikesdotnetting.com/Article /154/Looking-At-The-WebMatrix-WebGrid 并查看对 [Optional, Default Value(null)] string header
的引用
(如果您不需要数据库字段名称)
但我不确定如何格式化单元格值。例如,如果我有一个如下所示的 WebGrid:
Column Name Column Name Column Name Column Name
Cell value Cell value Cell value Cell value
Cell value Cell value Cell value Cell value
Cell value Cell value Cell value Cell value
Cell value Cell value Cell value Cell value
Cell value Cell value Cell value Cell value
我想让每个单元格都可单击,并且根据它所在的列,我希望其相应的超链接与另一个单元格的超链接不同。
这可以使用 WebGrid 来完成吗?我已经在 PHP 中完成了此操作,但不知道在哪里查找,也不知道如何使用 WebGrid 来完成此操作。
在搜索 Google、Bing 和 Yahoo!(?) 时,我只看到那些高级 WebGrid 组件的结果,而不是真正 WebGrid 的单个结果,也没有任何有帮助的结果。
I just read: http://www.mikesdotnetting.com/Article/154/Looking-At-The-WebMatrix-WebGrid and see a reference to [Optional, Default Value(null)] string header
Header text if you don't want database field names
But I'm not sure how to format cell values. For example, if I have a WebGrid that looks like this:
Column Name Column Name Column Name Column Name
Cell value Cell value Cell value Cell value
Cell value Cell value Cell value Cell value
Cell value Cell value Cell value Cell value
Cell value Cell value Cell value Cell value
Cell value Cell value Cell value Cell value
I would like to make each Cell clickable, and depending on the column it is in, I would like its corresponding hyperlink to be different from another cell's hyperlink.
Can this be done using WebGrid? I've done this in PHP, but have no idea where to look, or how to do it with WebGrid.
Upon searching Google, Bing and Yahoo!(?), I only see results for those premium WebGrid components, not a single result for the real WebGrid, nor any results that would be of any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您引用的 Mike 的 DotNetting 文章中,他展示了如何在以下代码行中显示短日期:
由于格式替换了整个单元格,因此您只需放置生成所需 HTML(包括超链接)的代码。由于生成任何复杂的内容可能会使该行代码难以阅读,因此最好编写自己的类/函数来生成所需的代码。我有这样的情况,我的格式行如下所示:
然后在该函数中:
在每个单元格中,都有一个编辑超链接,后跟文本注释。
In Mike's DotNetting article that you reference, he shows how to display the shortdate in the following line of code:
Since the format replaces the entire cell, you just need to put the code that produces the HTML you want, including hyperlinks. Since to produce anything complicated might make that line of code too painful to read, it might be best to write your own class/function that produces the code you want. I have a situation like that and my format line looks like:
And then in that function:
In each cell, there's an edit hyperlink, followed by a text comment.