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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

skip first 2 items in datalist

Status
Not open for further replies.

jamert

Programmer
Dec 9, 2007
80
CA
Hi this is what i have so far, i would like to skip the first two items in the datalist, prevent them from displaying, how can one go from here: thanks


protected void dlRisksDataBound(object sender, DataListItemEventArgs e)
{

HyperLink tmpLnk = (HyperLink)e.Item.FindControl("HyperLink1");
Label tmpLbl = (Label)e.Item.FindControl("Label1");

int RiskID;
RiskID = int.Parse(tmpLbl.Text);


if (RiskD == 16 || RiskD == 7)
{

skip first 2 items in datalist
start to display from 3rd on
}


////
idea of front page:

<asp:DataList ID="dlRisks" runat="server" OnItemCommand="dlRisks_ItemCommand" OnItemCreated="dlRisks_ItemCreated"
DataKeyField="RiskTypeID" OnItemDataBound="dlRisksDataBound" DataSourceID="SqlDataSource1">
<ItemTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" valign="top"><asp:Image ID="imgBall" runat="server" ImageUrl="~/Images/members-area/subnav-bullets/green.gif" Width="28" Height="20" />
<asp:Label ID="Label2" runat="server" Text='<%# Eval("PresentRisk") %>' Visible="false"></asp:Label>
</td>
<td valign="top"> <asp:HyperLink CssClass="subnav" ID="HyperLink1" runat="server"><%# Eval("RiskType")%></asp:HyperLink>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("RiskTypeID") %>' Visible="false"></asp:Label></td>
</tr>
</table>

</ItemTemplate>
</asp:DataList>
 
You should just be able to remove them from the list. In fact - you really shouldn't know that you need to skip the first 2 items - you should have your data filtered by some kind of criteria in which those first 2 items are not included. Even if that means adding an "Active" column.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top