Hi,
I have a RadListView where I am dynamically creating the layout template and insert template at runtime. Also just to let you know, I have the RadListView inside of a RadPanelBar whose ContentTemplate I am also creating at runtime. This RandPanelBar is within a NestedGridView of a RadGrid. All that is just an FYI as to the situation :) I have all of this working, but I am having an issue with inserting a value into my RadListView. I have a button that resides in the layouttemplate, where when I click it I am rebinding my listview and calling the ShowInsertItem command. This is correctly showing my Inserttemplate items, where I have a radcombobox and radnumerictextbox.
At this point after the user fills these things in, I have a save button that is clicked. This is where my problems lies. I need to be able to get the values of the radCombobox and radnumerictextbox from the edit template. I tried to access them using FindControl within the save click, but that only finds controls in the layouttemplate. So I wanted to implement the OnItemInserting event to be able to access the insert template. At first, I just performed a PerformInsert() call. But that gave me an error that the list view wasn't in insert mode. To get around this, I had to call ShowInsertItem again. By doing that, I can call PerformInsert. But the event isn't firing, even if I reattach the event to the list view (just to be sure, since it is a dynamic control). I tried changing my save button's CommandName to 'PerformInsert', but it seems to trigger an insert on the RadGrid and gives an error about it not being in insert mode. Below is the code in my btnSave_Click event, could someone tell me what I'm doing wrong? Or is there a way within my btnSave_Click event to access the controls in the InsertTemplate?
Thank you!
Richard
I have a RadListView where I am dynamically creating the layout template and insert template at runtime. Also just to let you know, I have the RadListView inside of a RadPanelBar whose ContentTemplate I am also creating at runtime. This RandPanelBar is within a NestedGridView of a RadGrid. All that is just an FYI as to the situation :) I have all of this working, but I am having an issue with inserting a value into my RadListView. I have a button that resides in the layouttemplate, where when I click it I am rebinding my listview and calling the ShowInsertItem command. This is correctly showing my Inserttemplate items, where I have a radcombobox and radnumerictextbox.
At this point after the user fills these things in, I have a save button that is clicked. This is where my problems lies. I need to be able to get the values of the radCombobox and radnumerictextbox from the edit template. I tried to access them using FindControl within the save click, but that only finds controls in the layouttemplate. So I wanted to implement the OnItemInserting event to be able to access the insert template. At first, I just performed a PerformInsert() call. But that gave me an error that the list view wasn't in insert mode. To get around this, I had to call ShowInsertItem again. By doing that, I can call PerformInsert. But the event isn't firing, even if I reattach the event to the list view (just to be sure, since it is a dynamic control). I tried changing my save button's CommandName to 'PerformInsert', but it seems to trigger an insert on the RadGrid and gives an error about it not being in insert mode. Below is the code in my btnSave_Click event, could someone tell me what I'm doing wrong? Or is there a way within my btnSave_Click event to access the controls in the InsertTemplate?
Thank you!
Richard
rlv.DataSource = rlv.Page.Session[rlv.UniqueID +
"_MyItems"
]List<MyItem>;
rlv.InsertItemTemplate =
new
CustomTemplate();
rlv.ShowInsertItem(RadListViewInsertItemPosition.LastItem);
rlv.PerformInsert();
// calls without error, but no event fired.
rlv.InsertItemPosition = RadListViewInsertItemPosition.None;