Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with DataList control

Status
Not open for further replies.

costintrifan

Technical User
Feb 8, 2007
2
RO
Hello, everybody!

I have a DataList control which displays data from 3 different xml files as DataSource.
To select which DataSource to display in the DataList I use a ComboBox.

The code for DataList is this:
Code:
<asp:DataList ID="DataRepeater" runat="server" HorizontalAlign="Left">
	<HeaderTemplate>
      	<table id="RssDataTable" cellpadding="0" cellspacing="0">
            	<tbody>
	</HeaderTemplate>
      <ItemTemplate>
           	<tr>
                 	<td class="DataRowTemplate">
                       	<asp:HyperLink ID="DataLink" runat="server"
							NavigateUrl='<%#Container.DataItem("Url")%>'
							ToolTip='<%#Container.DataItem("Name")%>'
							Target="_tabFrame"
							Text='<%#Container.DataItem("Name")%>'>
				</asp:HyperLink>
			</td>
		</tr>
	</ItemTemplate>
	<SeparatorTemplate>
      	<tr>
            	<td style="height: 2px;"></td>
		</tr>
	</SeparatorTemplate>
      <FooterTemplate>
      	</tbody>
		</table>
	</FooterTemplate>
</asp:DataList>
To navigate through records I use an Iframe as target for my DataList records (which are displayed as HyperLinks).
The Iframe is inside a TabPanel (the control from Ajax Toolkit) and it looks like this:
Code:
	<cc1:TabContainer ID="TabManager" runat="server" ActiveTabIndex="0">
      	<cc1:TabPanel ID="TabPanel1" runat="server" TabIndex="0">
            	<HeaderTemplate>
                  	<asp:Label ID="TabCaptionLabel" runat="server">Tab Caption</asp:Label>
			</HeaderTemplate>
                  <ContentTemplate>
                  	<iframe id="_tabFrame" name="_tabFrame"
					runat="server" allowtransparency="true" enableviewstate="true"
                              frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" class="TabFrame">
				</iframe>
			</ContentTemplate>
		</cc1:TabPanel>
	</cc1:TabContainer>
Every time I click on a record in DataList the Iframe displays the related page of the record (using NavigateUrl='<%#Container.DataItem("Url")%>')

To close the active TabPanel from the TabManager I would use this:
Code:
	<asp:HyperLink ID="CloseTabHyperLink" runat="server">Close tab</asp:HyperLink>
So, this is what I have.

But this is what I want to do:
- each time I click on a record I want to add a new TabPanel + an Iframe to display the page, inside my TabManager
- the caption of the tab I create should have the same data as the record has ( '<%#Container.DataItem("Name")%>' )

The problem is that whenever I select a record from the DataList the page is displayed in the Iframe whithout posting back the page.
So I need to know how can I create a new TabPanel inside a TabManager. (Notice that I've tried to create a few but all I could do was to add just one; when I wanted to add more than one, I got an exception : "The index was out of range".

I would appreciate any help! Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top