Search code examples
c#asp.netcode-behind

get Container.ItemIndex in code behind


I want to use Container.ItemIndex in my Code Behind in my function in OnCustomColumnDisplayText event in C#. Now I have dxwgv:ASPxGridView with OnCustomColumnDisplayText, where I have:

<dxwgv:GridViewDataTextColumn
    FieldName="PlainQuestion"
    VisibleIndex="1"
    Width="90%"
    Caption="Question">
    <DataItemTemplate>
        <%#Container.ItemIndex+1%>.  <%#Container.Text %>
    </DataItemTemplate>
</dxwgv:GridViewDataTextColumn>

So, I need to use it in Code Behind. Thanks!


Solution

  • Maybe you could use the VisibleRowIndex property of the ASPxGridViewColumnDisplayTextEventArgs of your CustomColumnDisplayText event handler

    http://documentation.devexpress.com/#AspNet/DevExpressWebASPxGridViewASPxGridView_CustomColumnDisplayTexttopic