在asp.net中对CommandArgument绑定,是不是只有在模板列中才能自己对CommandArgument绑定,但是在RowCommand事件中 由非模板列触发也可以获取到CommandArgument,请问下这样获取的CommandArgument又是什么,获取的是行号还是什么?

解决方案 »

  1.   

    CommandArgument 你绑的什么就是什么  ID 名字都可以
    例如下面就是ID。 
    <asp:LinkButton ID="lbtnEdit" runat="server" CommandName="studentEdit" CommandArgument='<%#Eval("studentID") %>'>Edit</asp:LinkButton>  
      

  2.   

    http://blog.csdn.net/czh4869623/article/details/7770745 参考。
      

  3.   

    refer : http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.button.commandargument%28v=vs.90%29.aspx
      

  4.   

    对于模板列中的绑定我会,我要问的是非模板列中CommandArgument的问题,在那里是不能自己写CommandArgument的吧,但是在CS代码中可以获取到,这个CommandArgument是什么呢
      

  5.   

    对于模板列中的绑定我会,我要问的是非模板列中CommandArgument的问题,在那里是不能自己写CommandArgument的吧,但是在CS代码中可以获取到,这个CommandArgument是什么呢就好比为是判断条件吧。例如一个button 你设置CommandArgument它为 del 
    在button 事件里面 执行的操作不是del就不执行 ,你看MSND解释就明白了http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.button.commandargument%28v=vs.90%29.aspx
      

  6.   

    对于模板列中的绑定我会,我要问的是非模板列中CommandArgument的问题,在那里是不能自己写CommandArgument的吧,但是在CS代码中可以获取到,这个CommandArgument是什么呢就好比为是判断条件吧。例如一个button 你设置CommandArgument它为 del 
    在button 事件里面 执行的操作不是del就不执行 ,你看MSND解释就明白了http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.button.commandargument%28v=vs.90%29.aspx

    我不是说CommandArgument是做什么用的,这些我都知道,对于listview,repeater的CommandArgument我用的都比较熟,但是在GridView中,非模板列不能绑定CommandArgument,可是在操作时可以获取到它的CommandArgument,我想问下,获取到的CommandArgument是什么,行号么
      

  7.   

    这个时候获取的CommandArgument应该是这一行的对象吧