views:

171

answers:

2

Hello everyone,

I have an question, On my page i have a DataView control, I also have a button that has CommandArgument. I know i can read the DataView as :

myDataView.Rows[i].FindControl("FaqQuestion");

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 DataView.

So my question is, how do i dinamicly add index of DataView.Rows[i] into CommmandArgument for the Button in runtime ?

Thanks in advance.

A: 
<ItemTemplate>
<%# Container.ItemIndex %>
</ItemTemplate>
Koistya Navin
A: 

Implement the OnDataBinding event for the button. In the event, assign the CommandArguemnt value to whatever you want. Normally you would assign an ID or some other identifier.

Kelsey