Change a column value depending on other column value in a grid
I have a Gridview that displays the user information. The columns in the Grid are UserID FirstName, LastName, DateOfBirth, Age. grid performs edit and delete functionalities. FirstName, LastName and DateOfBirth are editable.
My problem is when I change the DateOfBirth the age must be automatically updated, I have the method called AgeCalculator which takes DateOfBirth as a parameter and Calculates the Age(returns Number of years) depending on the DateOfBirth, I placed this method in a class and开发者_运维技巧 can access all the methods and properties by creating the object of class.
Can anyone tellme how can I update the age when DateOfBirth is changed.
Thanks,
I take it that reloading the page when something gets edited is not an option.
So the other option is doing it in the RowUpdating event.
You can do this in RowCommand
or Button submit
event / RowUpdating
event. Here you can pass DateOfBirth as input in your function.
精彩评论