CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Multiple Cells in ListBox

    I have a ListBox which contains 3 fields which i have combined to give me one row of text that looks as follows:

    Jan 28 2010 | D | Up Date
    Jan 15 2010 | I | The potential risk
    Jul 22 2010 | K | Risk reassesses

    I would like this to be split up into 3 cells in each row as follows:
    Cell 1 Cell 2 Cell 3
    Jan 28 2010 D Up Date
    Jan 15 2010 I The potential risk
    Jul 22 2010 K Risk reassesses

    My aspx code is as follows:
    Code:
            <tr>
            	<td class="fieldLabel" >
                    <asp:label id="Label2" runat="server">Past Reviews</asp:label>
                    <a href="javascript:help_create('Reason_Review')"> <img src="images/question_mark_icon.gif" border="0" /> </a>
                </td>
                <td>
                    <div id="test" style="OVERFLOW: auto; width:auto; height:auto; color:Aqua">
                    <asp:Panel id="panel2" runat="server" width="800" height="100px" ScrollBars="Auto" BackColor="Yellow">
                    <asp:ListBox ID="lbxPastRevs" runat="server" Width="8400px" Height="500px" DataTextField="ReviewList" DataValueField="revieweddate"></asp:ListBox>
                    </asp:Panel>
                    </div>
               </td>
           </tr>
    
    My aspx.cs code is as follows:
            protected void ResetReviewList()
            {
                lbxPastRevs.Items.Clear();
                DataTable dtReviews = new DataTable();
                dtReviews = DAL.GetInitialReviewTable(SessionInfo.EditID, string.Empty);
                lbxPastRevs.DataSource = dtReviews;
                lbxPastRevs.DataBind();
                if (dtReviews.Rows.Count > 0)
                {
                    lbxPastRevs.SelectedIndex = 0;
                }
    
    My dal.cs code is as follows:
            public DataTable GetInitialReviewTable(string historyID, string reviewid)
            {
                string sortorder = "";
                string rights = "";
    
                StringBuilder whereClause = new StringBuilder();
                string andClause = "where ";
    
                if (SessionInfo.ReviewSortOrder != String.Empty)
                    sortorder = " ORDER BY " + SessionInfo.ReviewSortOrder;
                else
                    sortorder = " ORDER BY edithistory_id, ReviewedDate ";
    
                if (!(historyID == "All"))
                {
                    whereClause.AppendFormat(" {0}EditHistory_ID={1}", andClause, historyID);
                    andClause = "and ";
                }
    
                if (!(reviewid == String.Empty))
                {
                    whereClause.AppendFormat(" {0}ReviewedDate={1}", andClause, reviewid);
                    andClause = "and ";
                }
    
                string sql = "SELECT * " + rights + "from review_information " + whereClause.ToString() + sortorder;
                return GetDataTable(sql);
            }
    Last edited by GremlinSA; April 19th, 2012 at 03:40 AM. Reason: Added code tags..

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Multiple Cells in ListBox

    I think it's time you look into using tables in HTML..
    w3schools has a great beginners tutorial
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured