Hi,
I am trying to create a dynamic CommandItemTemplate based on the selected item in the Grid. I have the ClientSettings.EnablePostBackOnRowClick set to true and Selecting-AllowRowSelect also set to true. I have tried to handle this in two different ways:
First, I tried to handle the ItemCommand event. I was able to get a reference to the GridDataItem that was selected and read the values, but setting the MasterTableView.CommandItemTemplate to my custom ITemplate object did not have any visual effect on the CommandItem. I believe this is because the commandItem has already been rendered at this point and doesn't get re-rendered.
My next attempt was to handle the ItemCreated event. I was now able to catch the creation of the CommandItem and get a reference to it, but now the Grid.SelectedItems collections was empty. Perhaps this hasn't been set yet at this point in the control lifecycle.
I'm open to other ways of doing this. Maybe by creating all of the controls that I want declaratively and just enabling or disabling them dynamically, but if the control has already been rendered or if I can't get at the SelectedItems collection, this still won't do me any good.
Any suggestions? Also, what are my options for doing this using client-side javascript instead?
Thanks,
Billy
I am trying to create a dynamic CommandItemTemplate based on the selected item in the Grid. I have the ClientSettings.EnablePostBackOnRowClick set to true and Selecting-AllowRowSelect also set to true. I have tried to handle this in two different ways:
First, I tried to handle the ItemCommand event. I was able to get a reference to the GridDataItem that was selected and read the values, but setting the MasterTableView.CommandItemTemplate to my custom ITemplate object did not have any visual effect on the CommandItem. I believe this is because the commandItem has already been rendered at this point and doesn't get re-rendered.
My next attempt was to handle the ItemCreated event. I was now able to catch the creation of the CommandItem and get a reference to it, but now the Grid.SelectedItems collections was empty. Perhaps this hasn't been set yet at this point in the control lifecycle.
I'm open to other ways of doing this. Maybe by creating all of the controls that I want declaratively and just enabling or disabling them dynamically, but if the control has already been rendered or if I can't get at the SelectedItems collection, this still won't do me any good.
Any suggestions? Also, what are my options for doing this using client-side javascript instead?
Thanks,
Billy