我想告诉你的朋友。服务服务类别和我有2个表。我添加的第一个服务类别。然后我添加了连接到服务类别的服务。到目前为止,好吧。然后我将服务类别放在前面的“服务”菜单下。稍后当我按此类别中的服务页面时,来自与此类别相关的服务。等等。但每项服务都有着作。让我举个例子;例如,我选择土壤服务类别=销售额因此是多项服务。这些服务即将出现在页面顶部。只有这一点来自所有服务的内容。我想只带一个。我如何根据ID进行制作。我正在使用实体框架。还有javascript插件正在运行。
<div id="filter">
<span>Kategori:</span>
<ul>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<li>
<asp:Label ID="lblId" runat="server" Text='<%#Eval("ID") %>' Visible="false" />
<asp:LinkButton ID="lnkId" Text='<%#Eval("HizmetAd") %>' class='<%#Eval("ID") %>'
runat="server" OnClick="GetGallery"></asp:LinkButton>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
</div>
<!-- begin gallery -->
<span>Gallery:</span>
<ul id="gallery" class="portfolio-grid clearfix">
<asp:Repeater ID="Repeater2" runat="server">
<ItemTemplate>
<li data-id="#" data-type="<%#Eval("ID") %>" class="entry one-fourth">
<div class="two-thirds">
<p>
<%#Eval("Yazi") %>
</p>
</div>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
<span>Hizmet Resim:</span>
<ul class="iconbox-carousel">
<asp:Repeater ID="Repeater3" runat="server">
<ItemTemplate>
<%--<li data-id="#" data-type="<%#Eval("ID") %>" class="entry one-fourth">--%>
<li>
<div class="iconbox computer">
<h4><a href="services.html#responsive-layouts">
<img src="/resimler/<%#Eval("ResimYol") %>" style="width: 220px; height: 150px;"></a> </h4>
<%-- <h4 class="entry-title"><%#Eval("KategoriAd") %></h4>--%>
</div>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
protected void Page_Load(object sender, EventArgs e)
{
GetKategori();
GetGalleryByKategori(3)// Here is automatic id have to come.;
GethizmetResim(3)//Here is automatic id have to come.;
}
private void GetKategori()
{
int ID = Convert.ToInt32(Request.QueryString["ID"]);
DataTable dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("HizmetAd");
dt.Columns.Add("Yazi");
dt.Columns.Add("KatID");
using (BesKardeslerPeyzajEntities krm = new BesKardeslerPeyzajEntities())
{
var krmekle = from v in krm.Hizmetler where v.HizmetKategori.ID == ID select v;
int i = 0;
foreach (var k in krmekle)
{
dt.Rows.Add();
dt.Rows[i]["ID"] = k.ID;
dt.Rows[i]["HizmetAd"] = k.HizmetAd;
dt.Rows[i]["Yazi"] = k.Yazi;
dt.Rows[i]["KatID"] = k.KatID;
i++;
}
Repeater1.DataSource = dt;
Repeater1.DataBind();
}
}
protected void GetGalleryByKategori(int id)
{
DataTable dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("HizmetAd");
dt.Columns.Add("Yazi");
dt.Columns.Add("KatID");
using (BesKardeslerPeyzajEntities krm = new BesKardeslerPeyzajEntities())
{
var krmekle = krm.Hizmetler.Where(h => h.ID == id).ToList();
int i = 0;
foreach (var k in krmekle)
{
dt.Rows.Add();
dt.Rows[i]["ID"] = k.ID;
dt.Rows[i]["HizmetAd"] = k.HizmetAd;
dt.Rows[i]["Yazi"] = k.Yazi;
dt.Rows[i]["KatID"] = k.KatID;
i++;
}
Repeater2.DataSource = dt;
Repeater2.DataBind();
}
}
private void GethizmetResim(int id)
{
//int ID = Convert.ToInt32(Request.QueryString["ID"]);
DataTable dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("Resimyol");
dt.Columns.Add("KatID");
using (BesKardeslerPeyzajEntities krm = new BesKardeslerPeyzajEntities())
{
var krmekle = from v in krm.HizmetResim where v.Hizmetler.ID==id select v;
int i = 0;
foreach (var k in krmekle)
{
dt.Rows.Add();
dt.Rows[i]["ID"] = k.ID;
dt.Rows[i]["Resimyol"] = k.ResimYol;
dt.Rows[i]["KatID"] = k.KatID;
i++;
}
Repeater3.DataSource = dt;
Repeater3.DataBind();
}
}
protected void GetGallery(object sender, EventArgs e)
{
LinkButton lnk = sender as LinkButton;
string id = ((Label)lnk.FindControl("lblId")).Text;
GetGalleryByKategori(Convert.ToInt32(id));
GethizmetResim(Convert.ToInt32(id));
}