关于Repeater的数据问题 Category ,Products ,Brand ,name 的值我都传过来了 但是Repeater不显示数据。麻烦高手帮忙看下下面代码哪里出错了public void bind(int nPageIndex)
{
int Category = 0; //大类ID
int Products = 0; //小类ID
int Brand = 0; //品牌ID
int Province = 0; //地区ID
string Price = ""; //第1个价格
string Price1 = ""; //第2个价格
string name = "";
if (Request.QueryString["Category"] != null)
{
if (Convert.ToInt32(Request.QueryString["Category"].ToString()) != 0)
{
Category = Convert.ToInt32(Request.QueryString["Category"].ToString());
}
}
if (Request.QueryString["Products"] != null)
{
if (Convert.ToInt32(Request.QueryString["Products"].ToString()) != 0)
{
Products = Convert.ToInt32(Request.QueryString["Products"].ToString());
}
}
if (Request.QueryString["Brand"] != null)
{
if (Convert.ToInt32(Request.QueryString["Brand"].ToString()) != 0)
{
Brand = Convert.ToInt32(Request.QueryString["Brand"].ToString());
}
}
if (Request.QueryString["Province"] != null)
{
if (Convert.ToInt32(Request.QueryString["Province"].ToString()) != 0)
{
Province = Convert.ToInt32(Request.QueryString["Province"].ToString());
}
}
if (Request.QueryString["Price"] != null)
{
Price = Request.QueryString["Price"].ToString();
}
if (Request.QueryString["Price1"] != null)
{
Price1 = Request.QueryString["Price1"].ToString();
}
if (Request.QueryString["SM_name"] != null)
{
name = Server.UrlDecode(Request.QueryString["SM_name"].ToString());
} int i, j;
NetCMS.SuppliesBLL.Supplies_Middle b_sm = new NetCMS.SuppliesBLL.Supplies_Middle(); DataTable dt = b_sm.GetPage(Category, Products, Brand, Province, Price, Price1, name, nPageIndex, 9, out i, out j, null);
if (dt.Rows.Count > 0)
{ if (i > 9)
{
this.PageNavigator1.PageCount = j;
this.PageNavigator1.PageIndex = nPageIndex;
this.PageNavigator1.RecordCount = i;
this.PageNavigator1.Visible = true;
}
else
{
this.PageNavigator1.PageCount = j;
this.PageNavigator1.PageIndex = nPageIndex;
this.PageNavigator1.RecordCount = i;
this.PageNavigator1.Visible = false;
}
this.Repeater1.DataSource = dt;
this.Repeater1.DataBind();
}
else
{
this.PageNavigator1.PageCount = j;
this.PageNavigator1.PageIndex = nPageIndex;
this.PageNavigator1.RecordCount = i;
this.PageNavigator1.Visible = false;
}
}
{
int Category = 0; //大类ID
int Products = 0; //小类ID
int Brand = 0; //品牌ID
int Province = 0; //地区ID
string Price = ""; //第1个价格
string Price1 = ""; //第2个价格
string name = "";
if (Request.QueryString["Category"] != null)
{
if (Convert.ToInt32(Request.QueryString["Category"].ToString()) != 0)
{
Category = Convert.ToInt32(Request.QueryString["Category"].ToString());
}
}
if (Request.QueryString["Products"] != null)
{
if (Convert.ToInt32(Request.QueryString["Products"].ToString()) != 0)
{
Products = Convert.ToInt32(Request.QueryString["Products"].ToString());
}
}
if (Request.QueryString["Brand"] != null)
{
if (Convert.ToInt32(Request.QueryString["Brand"].ToString()) != 0)
{
Brand = Convert.ToInt32(Request.QueryString["Brand"].ToString());
}
}
if (Request.QueryString["Province"] != null)
{
if (Convert.ToInt32(Request.QueryString["Province"].ToString()) != 0)
{
Province = Convert.ToInt32(Request.QueryString["Province"].ToString());
}
}
if (Request.QueryString["Price"] != null)
{
Price = Request.QueryString["Price"].ToString();
}
if (Request.QueryString["Price1"] != null)
{
Price1 = Request.QueryString["Price1"].ToString();
}
if (Request.QueryString["SM_name"] != null)
{
name = Server.UrlDecode(Request.QueryString["SM_name"].ToString());
} int i, j;
NetCMS.SuppliesBLL.Supplies_Middle b_sm = new NetCMS.SuppliesBLL.Supplies_Middle(); DataTable dt = b_sm.GetPage(Category, Products, Brand, Province, Price, Price1, name, nPageIndex, 9, out i, out j, null);
if (dt.Rows.Count > 0)
{ if (i > 9)
{
this.PageNavigator1.PageCount = j;
this.PageNavigator1.PageIndex = nPageIndex;
this.PageNavigator1.RecordCount = i;
this.PageNavigator1.Visible = true;
}
else
{
this.PageNavigator1.PageCount = j;
this.PageNavigator1.PageIndex = nPageIndex;
this.PageNavigator1.RecordCount = i;
this.PageNavigator1.Visible = false;
}
this.Repeater1.DataSource = dt;
this.Repeater1.DataBind();
}
else
{
this.PageNavigator1.PageCount = j;
this.PageNavigator1.PageIndex = nPageIndex;
this.PageNavigator1.RecordCount = i;
this.PageNavigator1.Visible = false;
}
}
<ItemTemplate>
<table width="530" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="24" rowspan="2" align="center" class="ypsj_xuxian">
<span class="ypsj_jianju"></span>
</td>
<td width="134" rowspan="2" align="center" class="ypsj_xuxian">
<a href="#">
<img src="../yp_images/fyrw_qiche.jpg" /></a>
</td>
<td width="260" rowspan="2" align="left" valign="top" class="ypsj_xuxian">
<p>
</p>
<a href='Supplies_Details.aspx?id=<%#Eval("SI_Id")%>&SM_Table=<%#Eval("SM_Table") %>'<!--WK 3.11号修改 &tablename改为&SM_Table -->
<style="display: block; margin-top: 5px; margin-bottom: 5px; font-size: 14px;
color: #0200CA">
<%#Eval("SM_Name")%></a>
<p>
<%#Eval("SM_Introduce")%></p>
</td>
<td width="122" height="30">
<p style="color: red; font-size: 14px; font-szie: 14px">
</p>
<p style="color: red; font-size: 14px; font-szie: 14px">
¥<%#Eval("SI_Price") %></p>
<p style="color: #058100">
<%#Eval("SM_AddTime")%></p>
</td>
</tr>
<tr>
<td width="122" height="90" align="left" class="ypsj_xuxian">
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
字段是否一致,加try catch
Repeater的数据问题 Category ,Products ,Brand ,name 的值我
===
没有转换成字符串类型啊