如何在Gridview中将两个值作为Command参数传递 [英] How to pass two values as Command argument in Gridview
本文介绍了如何在Gridview中将两个值作为Command参数传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在gridview的行命令事件中执行代码
每次我想从数据库中获取两个值命令参数
如何在gridview中的link buuton的命令参数中传递两个值
Hi,
I want to do code in row command event of gridview
and every time i want two value from database as command argument
How can i pass two values in command argument of link buuton inside the gridview
推荐答案
检查这些博客
http://aspdotnetcodebook.blogspot.com/2008/09 /how-to-pass-multiple-values-to.html [ ^ ]
http://www.daniweb.com/web-development/aspnet/threads/243715 [ ^ ]
http://stackoverflow.com/questions/2389258/passing-multiple-argument-through-commandargument-of-button-in-asp-net [< a href =http://stackoverflow.com/questions/2389258/passing-multiple-argument-through-commandargument-of-button-in-asp-nettarget =_ blanktitle =New Window> ^ ]
--NDK
check these blogs
http://aspdotnetcodebook.blogspot.com/2008/09/how-to-pass-multiple-values-to.html[^]
http://www.daniweb.com/web-development/aspnet/threads/243715[^]
http://stackoverflow.com/questions/2389258/passing-multiple-argument-through-commandargument-of-button-in-asp-net[^]
--NDK
您可以将rowindex作为命令参数传递并在Row_Command中检索该行。
You can pass rowindex as command argument and retrieve that row in Row_Command.
CommandArgument='<%# Container.DataItemIndex %>'
在你的row_Command中,你可以获得gridview行,然后在单元格中检索值。
In your row_Command you can get the gridview row and then retrieve values in cells.
protected void grdWhatever_RowCommand( object sender, GridViewCommandEventArgs e )
{
int rowIndex = Convert.ToInt32( e.CommandArgument );
GridViewRow row = grdWhatever.Rows[rowIndex];
}
您好,请在下方使用:
Hi, Use below:
CommandArgument='<%#Eval("Item_Id") +"|"+ (Container.ItemIndex+1)%>'
这篇关于如何在Gridview中将两个值作为Command参数传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文