如何只选择一个数字并获取所有名称

时间:2014-08-28 06:13:29

标签: c# javascript asp.net

  1. 样品: 1 BEEF 1 FRIED RICE 1 SPECIALTY BEEF 2 Kitchen 3 Dog
  2. 结果: 1 BEEF,油炸米饭,特色牛肉 2 厨房 3
  3. 假设 qno (1)是数字代码(牛肉)等是名称 如何显示一个数字并获取所有名称并将其返回到一个div中。我只使用一个div来显示所有数据。提前致谢。我知道这对你们来说很容易,但我花了太长时间来编码......

     **Here is the javascipt.**
      success: function (data) {
            $('#scrollIncoming').empty();
            for (var i in data) {
                var rc = '#' + (Math.random() * 0xFFFFFF << 0).toString(16);
                var qno = [data[i].QueueNo];
                for (var currentQueueNo = 0; currentQueueNo < qno.length; currentQueueNo++)
                   $('#scrollIncoming').append(
                            '<span style="background-color:' + rc + ';width: 33%;border:1px solid black;height: 220px;float: left;">' +
                                '<span style="font-size: 60px;color:white; text-align: center;margin-top:30px;margin-left: 150px">' + qno[currentQueueNo] + '</span>' +
                                '<span style="font-size: 10px;width: 33%;text-align: center;color:black;margin-top:80px;margin-left: 80px">' +
                                data[i].Quantity + '&nbsp' + data[i].Code +
                                '<span style="font-size: 20px;width: 33%;text-align: center;margin-top:150px;margin-left: 50px">' +
                                '<img src="./resources/images/dispatch.png"/></a>' +
                                '<img src="./resources/images/dispatchingPage.png"/></a>' +
                                '<img src="./resources/images/undo.png"/></a>' + '</span>' +
                    '<div id="div1">' +
                        '</div>'                   
                        );              
            $('#lblIncomingCounter').text(data.length);
            }
        }
    **Here is the aspx.**
        <form id="form1" runat="server">
                <div style="background-color: #ecf0f1; width: 100%; border: black 1px solid; margin: auto">
                    <div id="scrollIncoming">
                        <div id='container'>
                        </div>
                    </div>
                </div>
            </form>
    
    
    **Here is the code behind**
    listTransactions.Add(new ....()          {
        QueueNo = Convert.ToInt32(rdr["dd_queue_no"]),
        RefNo = Convert.ToInt32(rdr["key"]),
       Quantity =Convert.ToInt32(rdr["quantity"]),
       Code = Convert.ToString(rdr["name"]),
       OrderStatus = Convert.ToInt32(rdr[".."])
      });
    
     **Here is the sp**
    @cluster int,
        @order_status int
    ..
     declare
        @datetoday datetime
    
        set @datetoday = CONVERT (date, GETDATE())
    
        select 
            DISTINCT (t.dd_queue_no),
            t.[key],
            p.name,
            pt.quantity,
            t.dd_order_status
    
        from 
            transactions t
        inner join 
            product_transactions pt
        on 
            t.[key] = pt.transactions_key
        inner join
            products p
        ON 
            pt.[products_key] = p.[key]
        where 
            t.dd_cluster_key = @cluster and t.dd_order_status = @order_status
        and
            t.[datetime]
        between 
            cast(@datetoday+' 00:00:00' as datetime) and cast(@datetoday+' 23:59:00' as datetime)
        order BY
             [dd_queue_no]  
    

1 个答案:

答案 0 :(得分:0)

  var append = $('#scrollIncoming').append(
                              '<div  onclick="javascript:fnc' +
                              'UpdateStatus(' + data[j].RefNo + ',' + data[j].OrderStatus + ')">' +
                              '<div id="scrollIncoming' + data[j].QueueNo + '" class="mainDiv">' +
                              '<div class="mainDivHead"><span  class="detailsSpanHead">' + ata[j].QueueNo + '</span></div>' +
                              '<div id="innermo' + data[j].QueueNo + '" class="mainDivBody">' +
                              '<span class="detailsSpan">' + data[j].Quantity + ' - ' + data[j].Code + '</span></br>' +
                              '</div>' +
                              '</div>'
                                );

我的道歉,迟到的反应..顺便说一句,我已经解决了。谢谢bdw