|
-
Jun 22nd, 2010, 10:21 PM
#1
Thread Starter
Lively Member
[RESOLVED] is it possible using if in datarepeater?
hi all, is it possible using conditional in data repeater?
i have problem when generate data repeater.
Repeater will generate some Pivot table like this:
Type | January | February | March
========================================
xxxx |1500 | 0 |1500
yyyy |1800 | 1200 |1230
zzzzz |1200 | 0 |1400
the number will have hyperlink to detail report.
i know how to pass parameter from hyperlink like this;
<asp:Repeater ID="ROwnRiskCustomer" runat="server">
<HeaderTemplate>
<table width="60%" border="1">
<tr>
<th>Jenis</th>
<th>Januari</th>
<th>Februari</th>
<th>Maret</th>
</tr>
<ItemTemplate>
<tr>
<td>
<%#DataBinder.Eval(Container.DataItem, "Jenis")%>
</td>
<td>
<a href="OwnRiskCustomerDetail.aspx?th=<%#DataBinder.Eval(Container.DataItem, "Tahun") %>&bl=01"> <%#DataBinder.Eval(Container.DataItem, "01")%></a>
</td>
<td>
<a href="OwnRiskCustomerDetail.aspx?th=<%#DataBinder.Eval(Container.DataItem, "Tahun") %>&bl=02"> <%#DataBinder.Eval(Container.DataItem, "02")%></a>
</td>
<td>
<a href="OwnRiskCustomerDetail.aspx?th=<%#DataBinder.Eval(Container.DataItem, "Tahun") %>&bl=02"> <%#DataBinder.Eval(Container.DataItem, "02")%></a>
</td>
</tr>
this code is succes,but i want add some conditional .
so if the "01","02","03" return number zero then no hyperlink.
how can i add in asp.net??
i am using :
<td>
<%
If Eval("01") = 0 Then
%>
0
<%Else%>
<a href="OwnRiskCustomerDetail.aspx?th=<%#DataBinder.Eval(Container.DataItem, "Tahun") %>&bl=01"> <%#DataBinder.Eval(Container.DataItem, "01")%></a>
<% End If
%>
</td>
but this don't work because get error message
"Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control" 
any one can give me clue?
before this ,i have do it in Crystal report to show this master detail report,but i getting stuck when passing parameter for hyperlink. so i make backup plan if still don't get it in crystal report
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|