View Full Version : جستجو
pedram_ns
یک شنبه 05 مهر 1388, 08:16 صبح
سلام
من یک صفحه جستجو ایجاد کردم که بوسیله کنترل Datalist اطلاعات رو نشون می ده.
1.چطور می شه رکورد های یافت شده رو شمرد و تعدادشون رو اعلام کرد؟
2.اگه اطلاعات یافت نشد چطور پافت نشدن اطلاعات رو اعلام کرد؟
nazaninam
یک شنبه 05 مهر 1388, 08:25 صبح
Datalist1.Items.Count
اگر تعدا صفر بود اعلام کن که اطلاعاتی یافت نشد
pedram_ns
یک شنبه 05 مهر 1388, 14:04 عصر
کدهای من اینا هستن لطفا بگین این کد جدید رو کجا باید بنویسم و کمی در موردش توضیح بدین
با تشکر
<asp:DataList ID="DataList1" runat="server" DataKeyField="ID"
DataSourceID="Data" Width="100%" CellPadding="4" ForeColor="#333333">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<ItemTemplate>
<table cellpadding="0" cellspacing="0" class="style1">
<tr>
<td class="style28" width="15%">
<asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' />
</td>
<td class="style28" width="10%">
<asp:Label ID="CityLabel0" runat="server" Text='<%# Eval("Name") %>' />
</td>
</tr>
</table>
</ItemTemplate>
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#EFF3FB" />
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
</asp:DataList>
pedram_ns
یک شنبه 05 مهر 1388, 20:52 عصر
کسی نمی تونه کمک کنه؟
nazaninam
دوشنبه 06 مهر 1388, 10:31 صبح
در قسمت Code-Behind در رویداد Bind شدن Datalist
pedram_ns
چهارشنبه 08 مهر 1388, 10:01 صبح
من کدهای زیر رو نوشتم که اگه چیزی یافت نشد اعلام کنه ولی اگه پیدا کنه یا نکنه پیام نمایش داده می شه!
Protected Sub DataList1_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataList1.DataBinding
Dim count As Integer
count = DataList1.Items.Count
If count = 0 Then
Label3.Visible = True
Label3.Text = "No Find"
End If
Protected Sub DataList1_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataList1.DataBinding
Dim count As Integer
count = DataList1.Items.Count
If count = 0 Then
Label3.Visible = True
Label3.Text = "No Find"
End If
End Sub
pedram_ns
چهارشنبه 08 مهر 1388, 10:03 صبح
کدش اینه:
Protected Sub DataList1_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataList1.DataBinding
Dim count As Integer
count = DataList1.Items.Count
If count = 0 Then
Label3.Visible = True
Label3.Text = "No Find"
End If
End Sub
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.