我必须在索引控制器中将Id和Date值传递给操作结果(Update)。但我无法通过使用以下代码传递参数:
@(Html.Telerik().Grid(Model)
.Name("NotesDetails")
.DataBinding(dataBinding => dataBinding.Ajax().Select("ListAjax", "NotesDetails"))
.Columns(columns =>
{
columns.Bound(o => o.Flag).Visible(false).Title("Flag");
columns.Bound(o => o.Id).Visible(false).Title("Id");
columns.Command(commands =>
{
commands.Custom("Flag value")
.Text("<img id='flag' width='20' height='10' src = '/Content/images/Flag.png' >")
.Ajax(true)
.Action("Update", "Index", new { id=#-Id#, date = #-Date# });
}).Title("Flag");
columns.Bound(o => o.Date).Visible(true).Title("Date");
columns.Bound(o => o.Author).Visible(true);
columns.Bound(o => o.Task).Visible(true);
})
.Pageable(pager =>
{
pager.Style(GridPagerStyles.PageSizeDropDown | GridPagerStyles.NextPrevious);
pager.Position(GridPagerPosition.Both);
pager.PageSize(50, new int[] { 50, 100, 500 });
})
如果我给出像.Action这样的值(&#34;更新&#34;,&#34;索引&#34;,新{id = 123,日期=&#34; 2000/2/2&#34; });我收到了结果
提前致谢
答案 0 :(得分:0)
我们以Jquery的方式处理这个
Exception in thread "Thread-1" Exception in thread "Thread-2" Exception in thread "Thread-3" groovy.lang.GroovyRuntimeException: exception while reading process stream
at org.codehaus.groovy.runtime.ProcessGroovyMethods$TextDumper.run(ProcessGroovyMethods.java:495)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
at java.io.BufferedInputStream.read(BufferedInputStream.java:336)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.readLine(BufferedReader.java:324)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at org.codehaus.groovy.runtime.ProcessGroovyMethods$TextDumper.run(ProcessGroovyMethods.java:488)
... 1 more
groovy.lang.GroovyRuntimeException: exception while reading process stream
at org.codehaus.groovy.runtime.ProcessGroovyMethods$TextDumper.run(ProcessGroovyMethods.java:495)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
at java.io.BufferedInputStream.read(BufferedInputStream.java:336)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.readLine(BufferedReader.java:324)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at org.codehaus.groovy.runtime.ProcessGroovyMethods$TextDumper.run(ProcessGroovyMethods.java:488)
... 1 more
groovy.lang.GroovyRuntimeException: exception while dumping process stream
at org.codehaus.groovy.runtime.ProcessGroovyMethods$ByteDumper.run(ProcessGroovyMethods.java:517)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
at java.io.BufferedInputStream.read(BufferedInputStream.java:336)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.codehaus.groovy.runtime.ProcessGroovyMethods$ByteDumper.run(ProcessGroovyMethods.java:513)
... 1 more
Exception in thread "Thread-4" groovy.lang.GroovyRuntimeException: exception while dumping process stream
at org.codehaus.groovy.runtime.ProcessGroovyMethods$ByteDumper.run(ProcessGroovyMethods.java:517)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
at java.io.BufferedInputStream.read(BufferedInputStream.java:336)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.codehaus.groovy.runtime.ProcessGroovyMethods$ByteDumper.run(ProcessGroovyMethods.java:513)
并在jQuery中:
command.Custom("Update").Click("jQueryFilename.functionName").Text("Refresh User")
你需要设置jQuery选择器来获取你的id和日期,但这很简单。 快乐的编码!