How to insert two rows into the same table grid row? =)

Discussion in 'ASP.NET / ASP.NET Core' started by crackHeadAlis, Jul 3, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi ,
    I would like to know anyway to insert two strings into a row with 2 lines created?
    My codes are as below
    If NodeName = "subProductPrice" Then
    If xmlrder.NodeType = Xml.XmlNodeType.Text Then
    SubPrPriceList.Add(xmlrder.Value)
    For i = 0 To SubPrPriceList.Count - 1
    SubPrPrice = CStr(SubPrPriceList.Item(i))
    PriceBrkDownStr &= SubPrPrice
    Next
    PricePerDay = SvcDate & PriceBrkDownStr
    dr("dailyPrice") = PricePerDay
    End If
    End If
    Although both the SvcDate and PriceBrkDownStr are inserted into the same row but they are displayed into one line such as below:

    <u>dailyPrice </u>
    02/03/2007 03/03/2007 120 230

    Any idea how to make the date and price separate into two rows in the same table grid row? thanks =)
     
  2. Can you post the whole piece of code that populates the grid? The code you provided is not sufficient. Also Do you want a data grid with two columns 'SvcDate and PriceBrkDownSt' for which you have two row entries?

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Sure. Here are the codes:-





    Dim dt As DataTable


    Dim dr As DataRow


    Dim ds As New DataSet


    'create a DataTable


    dt = New DataTable("Main")


    dt.Columns.Add(New DataColumn("dailyPrice", GetType(String)))


    dt.Columns.Add(New DataColumn("availabilityStatus", GetType(String)))





    If NodeName = "subProductPrice" Then


    If xmlrder.NodeType = Xml.XmlNodeType.Text Then


    SubPrPriceList.Add(xmlrder.Value)


    For i = 0 To SubPrPriceList.Count - 1


    SubPrPrice = CStr(SubPrPriceList.Item(i))


    PriceBrkDownStr &amp;= SubPrPrice + " "


    PriceBrkDown &amp;= SubPrPrice + "+"


    Next


    'SubPrPrice &amp;= xmlrder.Value + " "


    PricePerDay = SvcDate &amp; System.Environment.NewLine &amp; PriceBrkDownStr


    dr("dailyPrice") = PricePerDay


    End If


    End If


    dt.Rows.Add(dr)


    SvcDate = " "


    PriceBrkDownStr = ""


    End Select








    ds.Tables.Add(dt)


    Iwant the whole string, "PricePerDay" to be inserted into the dailyPricetable grid row. I do not want 2 separatecolumns for SvcDate and PriceBrkDownStr. I want both to be in the same column of the table but different row. Got it? Thanks =)
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page