Hello All,
I need to add one dynamic column to gird view control to the last column(email) , this column not exist in DB.
My existing Gridview code here.Please help me to add i am getting that email column value from Other AD code.
UI
Hello All,
I need to add one dynamic column to gird view control to the last column(email) , this column not exist in DB.
My existing Gridview code here.Please help me to add i am getting that email column value from Other AD code.
UI
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.
Amit MohantyPosted Apr 14, 2023, 11:09 AM
Add a TemplateField control to the Columns collection of your GridView control:
Define a function to retrieve the email value for each row:
In the GetEmailValue function, you can use the userId parameter to retrieve the email value from your Active Directory code.
Naimish MakwanaPosted Apr 13, 2023, 11:43 AM
To add a dynamic column to GridView, you can add a new TemplateField to the GridView.Columns collection. You can then set the HeaderText property of the TemplateField to the column header text and add an ItemTemplate to define how the column value will be displayed for each row.
Assuming that you have the email value available in your code-behind, you can add the following code to create the dynamic column:
Note that you will need to create a new class for the ItemTemplate. You can do this by creating a new class that implements the ITemplate interface, like this:
The GetEmailValueForRow method should be replaced with your code to retrieve the email value for the current row. You can use whatever method you are using to retrieve the email value in your existing code. Once you have added the dynamic column to the GridView, it should display the email value for each row.
Thanks
Naimish Makwana