在前端不显示数据的问题 [英] problem in not showing data in front end

查看:327
本文介绍了在前端不显示数据的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个在线购物网站上工作.在该网站上,我给了两个模块admin和user.
在管理模块中,我已经填写了产品子类别表中的所有字段和数据.
现在我想在产品子类别表的用户模块中显示所有这些数据.但是没有数据显示也没有错误... im soo混淆plz帮帮我....下面是我的产品子类别页面的代码. ..plz评论...请指定您的答案...谢谢... !!!!!!!!!!

代码:-

I m working on a online shopping website.in which i have given two modules admin and user.
in admin module i have filled all the fields and data in product sub category table.
Now i wanted to show all those data in user module in product sub category table.but there is no data shown also no error...i m soo confuse plz help me....below there is code of my product sub category page...plz review...ans specify your answer...thanx...!!!!!!!!!!

code:-

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ProductSubCategory : System.Web.UI.Page
{
    Cls_FF c1 = new Cls_FF();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            filldl_subcategory();
        }
    }
    public void filldl_subcategory()
    {
        DataList2.DataSource = c1.selectDS("select * from ProSubCategory WHERE ProductId='" + Session["Pro_id"] + "'");
        DataList2.DataBind();
    }

    protected void DataList2_ItemCommand(object source, DataListCommandEventArgs e)
    {
        if (e.CommandName == "details")
        {
            string _subcatid;
            _subcatid = ((Label)DataList2.Items[e.Item.ItemIndex].FindControl("lbl_subid")).Text;
            Session.Add("subcatid", _subcatid);
            Response.Redirect("ProductDetail.aspx");

        }
    }
}





<%@ Page Title="" Language="C#" MasterPageFile="~/UserMasterPage.master" AutoEventWireup="true" CodeFile="ProductSubCategory.aspx.cs" Inherits="ProductSubCategory" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">

        .style6
        {
            width: 100%;
        }
        .style12
        {
            width: 100%;
            height: 144px;
        }
        .style13
        {
            width: 100%;
            height: 93px;
        }
        .style14
        {
            width: 100%;
            height: 49px;
        }
        .style18
        {
            width: 100%;
            height: 30px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table align="center" cellpadding="5" cellspacing="0" class="style6">
        <tr>
            <td align="center" class="style18">
                <asp:Label ID="Label3" runat="server" Font-Bold="True" Font-Size="Large"

                    ForeColor="#663300" Text="Product  Details"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="left">
                <asp:DataList ID="DataList2" runat="server"

                    onitemcommand="DataList2_ItemCommand" RepeatColumns="2">
                    <ItemTemplate>
                        <table align="center" cellpadding="5" cellspacing="0" class="style6">
                            <tr>
                                <td>
                                    <table align="center" cellpadding="5" cellspacing="0" class="style6">
                                        <tr>
                                            <td align="center" class="style9">
                                                <asp:ImageButton ID="ImageButton2" runat="server" CommandName="Details"

                                                    Height="112px" ImageUrl='<%# Eval("Image") %>' PostBackUrl="~/GemsDetails.aspx"

                                                    Width="137px" />
                                            </td>
                                            <td align="left">
                                                <table align="center" cellpadding="5" cellspacing="0" class="style6">
                                                    <tr>
                                                        <td align="center">
                                                            <asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Names="Vani"

                                                                ForeColor="#FF9900" Text='<%# Eval("SubCategoryName") %>'></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="Label5" runat="server" Font-Bold="True" Text="Retail Price:"></asp:Label>
                                                            &nbsp;&nbsp;&nbsp;&nbsp;
                                                            <asp:Label ID="Label6" runat="server" Font-Bold="True" Font-Names="Vani"

                                                                ForeColor="Black" Text='<%# Eval("Price") %>'></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="Label7" runat="server" ForeColor="#336600"

                                                                Text="Price For Limited Time"></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lbl_subid" runat="server" ForeColor="#996600"

                                                                Text='<%# Eval("SubCategoryId") %>' Visible="False"></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:LinkButton ID="LinkButton9" runat="server" CommandName="Details"

                                                                Font-Bold="True" ForeColor="#333300">Deatils...</asp:LinkButton>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:DataList>
            </td>
        </tr>
    </table>
</asp:Content>

推荐答案

检查几件事:

1.确保:
Check few things:

1. Make sure that the:
c1.selectDS("select * from ProSubCategory WHERE ProductId='" + Session["Pro_id"] + "'");


正在返回一些数据.
2.确保上面返回的数据是一个DataTable.数据源必须是数据表,而不是数据集.


is returning some data.
2. Make sure that data returned above is a DataTable. DataSource needs to be a datatable and not DataSet.


这篇关于在前端不显示数据的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆