Click here to Skip to main content
15,905,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is the problem (they code with underline)?The page is opening but not the data

C#
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="kategori.aspx.cs" Inherits="kategori" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:DataList ID="DataList2" runat="server" DataSourceID="secilenKategori">
    </asp:DataList>
    <asp:SqlDataSource ID="secilenKategori" runat="server" 
        ConnectionString="<%$ ConnectionStrings:veritabaniConnectionString2 %>" 
        ProviderName="<%$ ConnectionStrings:veritabaniConnectionString2.ProviderName %>" 
        SelectCommand="SELECT * FROM kategoriler " FilterExpression="idkategoriler = {0}">
        <FilterParameters>
	                    <asp:QueryStringParameter QueryStringField="id" Name="idkategoriler"  />
                    </FilterParameters>    </asp:SqlDataSource>
</asp:Content>
Posted
Comments
ZurdoDev 2-Apr-12 14:16pm    
Are you passing the id in via query string?
Bernhard Hiller 3-Apr-12 2:57am    
"but not the data" - what does that mean: no data are shown though you expect some, or all data are shown including data not matching the search criteria?
"idkategoriler" looks like a plural - does it work when you supply a single id value to the query instead of a list?

1 solution

Ihave the correct code find.(they width underline)
C#
<![CDATA[<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="kategori.aspx.cs" Inherits="kategori" %>]]>

<asp:content id="Content1" contentplaceholderid="HeadContent" runat="Server" xmlns:asp="#unknown">
</asp:content>
<asp:content id="Content2" contentplaceholderid="MainContent" runat="Server" xmlns:asp="#unknown">
 <asp:datalist id="DataList2" runat="server" datasourceid="SqlDataSource1">
            DataKeyField="idkategoriler">
            <itemtemplate>
                idkategoriler:
                <asp:label id="idkategorilerLabel" runat="server">
                    Text='<%# Eval("idkategoriler") %>' />
                <br />
                kategoriAdi:
                <asp:label id="kategoriAdiLabel" runat="server">
                    Text='<%# Eval("kategoriAdi") %>' />
                <br />
                kategoriImg:
                <asp:label id="kategoriImgLabel" runat="server">
                    Text='<%# Eval("kategoriImg") %>' />
                <br />
                kategoriIcerik:
                <asp:label id="kategoriIcerikLabel" runat="server">
                    Text='<%# Eval("kategoriIcerik") %>' />
                <br />
<br />
            </asp:label></asp:label></asp:label></asp:label></itemtemplate>
        </asp:datalist>
        <asp:sqldatasource id="SqlDataSource1" runat="server">
            ConnectionString="<%$ ConnectionStrings:veritabaniConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:veritabaniConnectionString.ProviderName %>" 
            SelectCommand="SELECT * FROM kategoriler" FilterExpression="idkategoriler = {0}">
                    <filterparameters>
	                    <asp:querystringparameter querystringfield="id" name="idkategoriler" defaultvalue="1" />
                    </filterparameters>
                    </asp:sqldatasource></asp:content>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900