How to edit a template grid column (ColumnType="Template") in a batch update process

1 reply. Last post: March 4, 2010 10:53 PM by Andi Santoso
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
lybaxMember

I need to bind a different dropdown for each row in my grid in order to edit a column using this control.

I cannot use EditType="WebComboNET" or EditType="DropdownList" on my column because these edit controls are the same for each row.

So I need to use ColumnType="Template", EditType="NoEdit" and specify a custom asp dropdownlist in my CellTemplate that will be initilaized during InitializeRow event.

This dropdown includes a client-side "onChange" event:

function ddl_change(ddlClientId) 
{
    var grid = ISGetObject('<%= wg.ClientID %>');
    var row = grid.GetSelectedObject().GetRowObject(); 
    var cell = row.GetCell("MyColumn");
    var ddl = document.getElementById(ddlClientId);

    cell.SetValue(ddl.value);
    row.AddPendingChanges();
    //row.SetDataChanged();
}

I tried several possibilities in the last 3 lines.

SetValue is needed for the pending changes summary and the batch update.

The problem is that this method removes my dropdownlist and replaces it by a simple text with all values from the dropdownlist.

Why is my dropdown disappearing? 
Why is the replaced text containing all my dropdown values?
How do I set my selected value in order to perform the batch update?
Is there another solution to do this?

All times are GMT -5. The time now is 4:31 AM.
Previous Next