Q:

passing rowindex to javascript

I am trying to pass row index from inside my gridview to javascript function and I am getting an error that databind does not contain a property name container.
<label style="text-decoration: underline" onclick="javascript:GetSelectedRow('<%# Eval("ID") %>','<%# Eval("root__level") %>','<%# Eval("ParentMclid") %>','<%# Eval("systempath") %>','<%# Eval("Container.DataItemIndex + 1") %>);"><%#Eval("ID") %></label>

I just want to pass the rowindex of the gridview to the javascript function.
.

A:

Try <%# Container.DataItemIndex %> instead.
Container is an object exposed to you during data binding, you don't need to include it in your Eval statement. Only use Eval when you need to access a property or item in your data source. Also, Eval("chicken") is really a shortcut to DataBinder.Eval(Container, "chicken").

