I'm sure I'm missing something simple here! I want to load content from my database into several tabs. I have the standard RadTabStrip and RadMultiPage element set up in the aspx code.
In my backend VB code I want to add several tabs. I have this so far:
| Dim tab As RadTab = New RadTab |
| Me.TabStrip.Tabs.Add(tab) |
| tab.Text = "Tab #3" |
| ' this bit is not doing anything at present |
| Dim pageView As RadPageView = New RadPageView |
| Me.TabPages.PageViews.Add(pageView) |
The tab gets added to the tab strip, but when I click it there is no content area. I've looked through all the examples and haven't seen anything that actually adds the tab content, only the tabs. Can anyone help?
6 Answers, 1 is accepted
I figured it out eventually. Firstly I had mismatching IDs on the RadMultiPage element and the MultiPageID attribute of RadTabStrip.
Next between the two pageView lines of code at the bottom, you need to add this to add content to the tab:
| pageView.Controls.Add(element) |
Now I have another problem... the above work fine when displaying the editors (I have a RadEditor in each tab), but when trying to save the data I can't get hold of the editor controls. I'm using the RadAjaxManager to call this function when I click the save button in any of the editors:
01.Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As AjaxRequestEventArgs) 02. If e.Argument = "Save" Then03. For Each pageView As RadPageView In Me.TabPages.PageViews 04. 'Dim editor As RadEditor = pageView.Controls.Item(0) 05. RadAjaxManager1.Alert(pageView.ID & "\n" & pageView.Controls.Count) 06. Next07. 08. RadAjaxManager1.Alert("Client notes saved.") 09. End If10.End SubI get an error on the commented line because the pageView doesn't have any controls in it - but I added them in and they're displaying okay! How can I get the content from the RadEditors on my page? Or is it possible to at least get the one that's being saved?
When you add the editor dynamically to the pageview it is not persistent after a postback and should be added again - actually this is true for all dynamically added controls.
All the best,
Yana
the Telerik team
I gave it a try and no luck. Is there a way to pass the content and ID into the AjaxRequest function? I have this javascript that handles the Save command:
1.function ajaxRequest(operation) { 2. var ajaxManager = <%= RadAjaxManager1.ClientID %>; 3. ajaxManager.ajaxRequest(operation); 4.} 5. 6.RadEditorCommandList["Save"] = function(commandName, editor, oTool) { 7. ajaxRequest("Save"); 8.} I'm guessing I would use the "editor" parameter there. I managed to find an object member with the HTML - editor._contentArea.innerHTML - but I can't find the ID.
The other problem is how to pass this into the server-side funciton, because I can only seem to pass one value, "operation". On the sever-side, e.Argument just contains "Save" and nothing else.
You can read how to pass more than one argument here.
Regarding the editor id and text, you can use the following methods:
editor.get_id();editor.get_text();More information about the client-side API of RadEditor can be found here.
Best wishes,
Yana
the Telerik team