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

Threaded View

  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..

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