views:

30

answers:

1

I have a ASPX page where i am rendering a Datagrid with some values. I am creating BoundCoulmns dynamically in my code behind like the following,

        BoundColumn iCustomer = new BoundColumn();
        iCustomer.HeaderText = "Customer";
        iCustomer.DataField = "CustomerName";
        dgridProspList.Columns.Add(iCustomer);
        dgridProspList.DataBind();

This will show the CustomerName as i have assigned it to the datafield property.Now i want to do some modification on this CustomerName.ie; I want to pass this "CustomerName" and the return value of the function ,i need to assign as the DAtaField.Is there any way to do it ?

+1  A: 

If I've got the right end of your stick the way you can do this is by using the datagrids ondatabound event. Within this event you will need to pick out the cell with the customer name in it (something like row.cells[3]). From here you should be able to set the contents how ever you want.

Hopefully this will help

Can u please post a small code snippets to do that
Shyju