在Gridview的模板里,控件的CommandArgument向后台传递多个参数
2011-08-01 11:44
477 查看
前台的控件的CommandArgument绑定后台的一个public的方法,绑定的方法返回
<asp:LinkButton ID="lbtnViewRz" runat="server" CommandName="ViewRz" CommandArgument='<%#getIdandFlow(Eval("Id"),Eval("FlowId") )%>' ToolTip='<%#Eval("rzxmmc") %>'><%#CommonClass.getContentByLength(Eval("rzxmmc"),10)%></asp:LinkButton>
--后台的方法
#region 返回Id+,+FlowId
/// <summary>
/// 返回Id+,+FlowId
/// </summary>
/// <param name="Id"></param>
/// <param name="FlowId"></param>
/// <returns></returns>
public string getIdandFlow(object Id, object FlowId)
{
string Result = string.Empty;
if (!string.IsNullOrEmpty(Id.ToString())&&!string.IsNullOrEmpty(FlowId.ToString()))
{
Result = Id.ToString() + "," + FlowId.ToString();
}
return Result;
}
#endregion
在绑定控件的GridView1_RowCommand方法里调用
string id = e.CommandArgument.ToString();
string []strTempValue = id.Trim(new char[] { ',' }).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
<asp:LinkButton ID="lbtnViewRz" runat="server" CommandName="ViewRz" CommandArgument='<%#getIdandFlow(Eval("Id"),Eval("FlowId") )%>' ToolTip='<%#Eval("rzxmmc") %>'><%#CommonClass.getContentByLength(Eval("rzxmmc"),10)%></asp:LinkButton>
--后台的方法
#region 返回Id+,+FlowId
/// <summary>
/// 返回Id+,+FlowId
/// </summary>
/// <param name="Id"></param>
/// <param name="FlowId"></param>
/// <returns></returns>
public string getIdandFlow(object Id, object FlowId)
{
string Result = string.Empty;
if (!string.IsNullOrEmpty(Id.ToString())&&!string.IsNullOrEmpty(FlowId.ToString()))
{
Result = Id.ToString() + "," + FlowId.ToString();
}
return Result;
}
#endregion
在绑定控件的GridView1_RowCommand方法里调用
string id = e.CommandArgument.ToString();
string []strTempValue = id.Trim(new char[] { ',' }).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
相关文章推荐
- GridView中通过CommandArgument传递多个参数的例子
- GridView控件CommandArgument 绑定多个参数
- GridView控件CommandArgument 绑定多个参数
- 在ASP.NET GridView 中使用e.CommandArgument传递参数
- GridView使用DataKeyNames的例子 & CommandArgument传递多个参数 & 获取GridView编辑状态下单元格里的值
- GridView使用DataKeyNames的例子 & CommandArgument传递多个参数 & 获取GridView编辑状态下单元格里的值
- GridView中CommandArgument如何传多个参数
- GridView 模板列 在后台获取该行某控件的值 例如批量修改
- GridView模板的LinkButton传递多个参数
- Silverlight实用窍门系列:23.Silverlight多线程技术Thread的应用,后台线程更新UI控件,向多线程传递参数【附带源码实例】
- aspx GridView 动态绑定 CommandArgument中使用后台方法
- 23.Silverlight多线程技术Thread的应用,后台线程更新UI控件,向多线程传递参数
- easyui-combotree传递参数到后台获取json值来绑定combotree控件
- GridView之实用第一招:CommandArgument 绑定多个参数
- GridView 模板列 在后台获取该行某控件的值 例如批量修改
- 通过CommandArgument传递多个参数的尝试
- GridView 动态添加模板列并绑定数据 实现从外部直接传入控件 和 绑定字段参数
- CommandArgument 传递参数
- GridView模板的LinkButton传递多个参数
- GridView CommandArgument 绑定多个参数