文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>GridView模板的LinkButton传递多个参数

GridView模板的LinkButton传递多个参数

时间:2010-10-21  来源:ggbbeyou

.aspx中的代码为:

view plaincopy to clipboardprint?
01.<asp:TemplateField HeaderText="课程编号" SortExpression="课程编号">  
02.                            <ItemTemplate>  
03.                                <asp:LinkButton ID="LinkButtonCourseNO" runat="server"   
04.                                    Text='<%# Bind("课程编号") %>' CommandName="ButtonClick"   
05.                                    CommandArgument='<%# Eval("ID")+","+Eval("课程名称")+","+Eval("Approved")%>'></asp:LinkButton>  
06.                            </ItemTemplate>  
07.                        </asp:TemplateField> 
<asp:TemplateField HeaderText="课程编号" SortExpression="课程编号">
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButtonCourseNO" runat="server"
                                    Text='<%# Bind("课程编号") %>' CommandName="ButtonClick"
                                    CommandArgument='<%# Eval("ID")+","+Eval("课程名称")+","+Eval("Approved")%>'></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>

.cs代码为:

 
view plaincopy to clipboardprint?
01.protected void GViewOutlineList_RowCommand(object sender, GridViewCommandEventArgs e)  
02.{  
03.    if(e.CommandName == "ButtonClick")  
04.    {  
05.        //Response.Write(e.CommandArgument.ToString());  
06.        object [] arguments = e.CommandArgument.ToString().Split(',');  
07.        //Response.Write(arguments.Length.ToString());  
08.        //int OutlineID = Convert.ToInt32(e.CommandArgument);  
09.        Response.Redirect("a.aspx?OutlineID="+Convert.ToInt32(arguments[0])+"&CourseName="+arguments[1].ToString()+"&StateApproved="+Convert.ToInt32(arguments[2]));  
10.    }  
11.} 

 

本文来自CSDN博客,出处:http://blog.csdn.net/kdmhh/archive/2009/08/26/4485762.aspx

相关阅读 更多 +
排行榜 更多 +
西安交大通

西安交大通

生活实用 下载
长江云通

长江云通

生活实用 下载
translatez

translatez

生活实用 下载