PDA

View Full Version : سوال: مشکل نمایش در datalist



30yamand
یک شنبه 16 شهریور 1393, 15:43 عصر
سلام دوستان یکی ببینه مشکلش چیه وقتی اجرا میکنم هیچی نمایش داده نمیشه


<asp:DataList ID="DataList1" runat="server" RepeatColumns="3"
OnItemCommand="DataList1_ItemCommand">
<ItemTemplate>
<asp:Panel ID="pnlProduct" runat="server" Style=" background-color: orange;border-color: orange; border-radius: 10px; padding: 10px;"
Height="200px" Width="185px" BackColor="orange">
<table height="150px">
<tr>
<td width="75%" style="color: #ff0000; font-weight: bold;" >
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%# Eval("image") %>' CommandName="ViewDetails" CommandArgument='<%# Bind("id") %>'></asp:ImageButton>
</td>
</tr>
<tr>
<td width="75%" style="color: #0000ff; font-weight: bold">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("name") %>'/>
</td>
</tr>
<tr>
<td width="50%" style="color: #ff0000; font-weight: bold">
<asp:Label ID="Label3" runat="server" Text='<%# Eval("review").ToString().PadLeft(50).Substring(0,40)+"..." %>'/>
<span style="color:Black; font-weight: bold;">ProductDetails:</span><br />
</td>
</tr>
<tr>
<td width="75%" style="color: #009900; font-weight: bold"><span style=" color: Black; font-weight: bold;">Price:</span>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("price") %>'/>
</td>
</tr>

<tr>
<td >
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="ViewDetails" CommandArgument='<%# Eval("id") %>' BackColor="#ff9933">Detils/Order</asp:LinkButton>
</td>
</tr>
</table>
</asp:Panel>
</ItemTemplate>
</asp:DataList>


protected void Page_Load(object sender, EventArgs e)
{
GetData();
}


public void GetData()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrin gs["ParandDBConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("select * from mahsool", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
DataList1.DataSource = ds.Tables[0].DefaultView;
DataList1.DataBind();


}