Link to home
Start Free TrialLog in
Avatar of VD1234
VD1234

asked on

Template column values on Edit Command

I have a template column that has a drop down list. The values for this column are assigned in the Item Databound event.
I have the following issues:
 When I click on the Edit button in the edittemplate, the Template column loose there values. I want this row to start in edit mode, however the template columns should still retain there values.

How do I achieve this. Thanks in advance.
Avatar of Munawar Hussain
Munawar Hussain
Flag of Pakistan image

when you create a templated column . bydefault controls are placed in edite template according to selected dataType for that column and data is not lost on edit .. but for that you need to make sure that you are rebinding to datasource after its mode is changed to edit.

2nd if you are putting conrols in templated field manully then you need to bind yourself ..
Avatar of VD1234
VD1234

ASKER

Data is not lost. What I actually want is for example if I have a drop down list in the edittemplate, I want the selectedvalue to remain the same even after the edit buton is clicked. But the drop down has no selected value as soon as the Edit button is clicked.

I bind the datagrid as follows:
protected void dgDynamicFields_Edit(object source, DataGridCommandEventArgs e)
        {
            // Enter edit mode
            dgDynamicFields.EditItemIndex = e.Item.ItemIndex;
            dtDynamic = objAdmin.Get_DynamicFields().Tables[1];
            BindGrid();
       
        }
ASKER CERTIFIED SOLUTION
Avatar of Munawar Hussain
Munawar Hussain
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
Community Support Moderator