<%# Container.DataItemIndex+1 %>
2,4 row is hiding.
after hiding 2 rows it will be 1,3,5,67 like that
how to correct this in 1,2,3,4,5 like that
<%# Container.DataItemIndex+1 %>
2,4 row is hiding.
after hiding 2 rows it will be 1,3,5,67 like that
how to correct this in 1,2,3,4,5 like that
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Deepak TewatiaPosted Dec 18, 2022, 4:20 PM
Hi lijo,
Based on your problem statement to fix the row numbers after hiding some rows, you can use the RowDataBound event to update the row numbers in the template field. Use the below code snippet to do this:
we are using a Label control with an ID of "lblRowNumber" in the template field to display the row number. You can adjust the code to fit your specific requirements.
Aravind GovindarajPosted Dec 18, 2022, 10:05 AM
Create a RowNumber as a property and apply the logic before getting into the grid view. Change the code to use new Property RowNumber instead of <%# Container.DataItemIndex+1 %>