I have an question, On my page i have a ListView control, I also have a button that has CommandArgument. I know i can read and find a control in the ListView as :
ListView.Items[i].FindControl('controlname');
and my button in ListView is like that
asp:Button ID='WisdomButton' runat='server' CommandName='UpdateWisdom' CommandArgument='<%# need my index for Item[i] to post here %>' OnCommand='UpdateWisdom' Text='Update' />
I want to add index value in runtime to the CommantParameter, so when i go to the Function onCommand i will know exactly from what row[i] i Need to get my controls from ListView.
So my question is, how do i dinamicly add index of ListView.Rows[i] into CommmandArgument for the Button in runtime ?
Thanks in advance.
Check out the API
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listviewcommandeventargs.aspx
The ListViewCommandEventArgs item has an index, IE it is already available in the argument
But from here you will have access to those controls
If you are calling the method a different way you could aways assign the index through an ItemDataBound Event
OR try something like this for giggles