gheysar14
سه شنبه 16 آذر 1389, 12:43 عصر
سلام
من میخام یه جدوا مشابه http://www.foxconnchannel.com/product/Motherboards/socket_list.aspx?platform_id=en-us0000001&platform_name=Intel+platform درست کنم. از کنترل listview استفاده میکنم و موقع بایند کردن کنترل ها از کد زیر استفاده می کنم. ولی میخام تو تگ TD یه RowSpan بدم و مقدار اون میشه به تعداد دفعاتی که فیلد CatName مقدار تکراری ( مثلاً Socket1366) داره . ولی نمیدونه چطوری این مقدارو بدست بیارم؟
<table class="ProductTable" >
<tr><td class="headCaption " colspan="4"><asp:Label ID="Label3" runat="server" Text="Label"></asp:Label></td></tr>
<asp:ListView ID="ListView1" runat="server" >
<ItemTemplate>
<tr>
<td class="tdButomnBorder"><%#Eval("CatName")%></td>
<td class="tdButomnBorder"><%#Eval("SubCatName")%></td>
<td class="tdButomnBorder"><a href="Product.aspx?prdID=<%#Eval("prdID")%>"><%#Eval("prdName")%></a></td>
<td class="tdButomnBorder"><%#Eval("Price", "{0:c}")%></td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<div id="itemPlaceHolderContainer" runat="server">
<div id="itemPlaceHolder" runat="server"></div>
</div>
</LayoutTemplate>
<EmptyItemTemplate>
<asp:Label ID="lblEmpty" runat="server">No Data To Display</asp:Label>
</EmptyItemTemplate>
</asp:ListView>
</table>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CatID = Request.QueryString("CatigoryID").ToString
Dim cmd As New SqlCommand("select ProductType.prdType,ProductType.prdTypeID,ProductC atigory.CatName,ProductCatigory.SubCatName,product s.prdName,Products.prdID,price from ProductCatigory inner join ProductType on ProductCatigory.prdTypeID=ProductType.prdTypeID inner join products on Products.CatigoryID=ProductCatigory.CatigoryID where ProductType.prdTypeID=" + CatID, conn)
cmd.CommandType = CommandType.Text
Try
conn.Open()
dr = cmd.ExecuteReader
While dr.Read
ListView1.DataSource = dr
ListView1.DataBind()
End While
conn.Close()
dr.Close()
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
من میخام یه جدوا مشابه http://www.foxconnchannel.com/product/Motherboards/socket_list.aspx?platform_id=en-us0000001&platform_name=Intel+platform درست کنم. از کنترل listview استفاده میکنم و موقع بایند کردن کنترل ها از کد زیر استفاده می کنم. ولی میخام تو تگ TD یه RowSpan بدم و مقدار اون میشه به تعداد دفعاتی که فیلد CatName مقدار تکراری ( مثلاً Socket1366) داره . ولی نمیدونه چطوری این مقدارو بدست بیارم؟
<table class="ProductTable" >
<tr><td class="headCaption " colspan="4"><asp:Label ID="Label3" runat="server" Text="Label"></asp:Label></td></tr>
<asp:ListView ID="ListView1" runat="server" >
<ItemTemplate>
<tr>
<td class="tdButomnBorder"><%#Eval("CatName")%></td>
<td class="tdButomnBorder"><%#Eval("SubCatName")%></td>
<td class="tdButomnBorder"><a href="Product.aspx?prdID=<%#Eval("prdID")%>"><%#Eval("prdName")%></a></td>
<td class="tdButomnBorder"><%#Eval("Price", "{0:c}")%></td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<div id="itemPlaceHolderContainer" runat="server">
<div id="itemPlaceHolder" runat="server"></div>
</div>
</LayoutTemplate>
<EmptyItemTemplate>
<asp:Label ID="lblEmpty" runat="server">No Data To Display</asp:Label>
</EmptyItemTemplate>
</asp:ListView>
</table>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CatID = Request.QueryString("CatigoryID").ToString
Dim cmd As New SqlCommand("select ProductType.prdType,ProductType.prdTypeID,ProductC atigory.CatName,ProductCatigory.SubCatName,product s.prdName,Products.prdID,price from ProductCatigory inner join ProductType on ProductCatigory.prdTypeID=ProductType.prdTypeID inner join products on Products.CatigoryID=ProductCatigory.CatigoryID where ProductType.prdTypeID=" + CatID, conn)
cmd.CommandType = CommandType.Text
Try
conn.Open()
dr = cmd.ExecuteReader
While dr.Read
ListView1.DataSource = dr
ListView1.DataBind()
End While
conn.Close()
dr.Close()
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub