我想实现一个功能,就是让用户自己选择要显示的网页中的表格的行和列.
比如说看股市行情中,用户自己可以选择要看的股票的名称,最高价格,最低价格, 成交量,最新报价等等.他可以选择看这些栏目中的几个和看哪些股票.
谢谢啊.

解决方案 »

  1.   

    在代码里用response.write输出html的table语句,当然具体要根据设置的条件实现,这是基本思路,所谓的用代码“画”表格
      

  2.   

    选择要看的信息的时候,在后台输出相应的要显示的东西的HTML代码,用ICallbackEventHandler接口来实现,这样可以实现同步,直接返回到客户端来显示
      

  3.   

    给你段参考代码
    public string GetCallbackResult()
      {
        if (!string.IsNullOrEmpty(ChatTo))
          return FormatMessage(MessageManager.GetNewMessages(MaxId, ChatTo));
        else
          return "";
      }  protected string FormatMessage(List<Messaging.DataProvider.MessageRecord> messages)
      {
        if (messages.Count == 0) return "";
        string temp = "";
        ArrayList messageId = new ArrayList();
        foreach (Messaging.DataProvider.MessageRecord i in messages)
        {
          temp += "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">";
          temp += "<tr>";
          temp += "<td align=\"left\" width=\"100%\">";
          if (i.ReceiveOrSend == false)
            temp += i.ChatTo + "对我说:";
          else
            temp += "我对" + i.ChatTo + "说:";
          temp += i.SendTime + " </td>";
          temp += "</tr>";
          temp += "<tr>";
          temp += "<td width=\"100%\" align=\"left\"><font color=\"#C66FFF\">";
          temp += i.Content + " </font></td> </tr> </table>";
          messageId.Add(i.ID.ToString());
          MaxId = i.ID;
        }
        return temp;
      }  public void RaiseCallbackEvent(string Max)
      {
        MessageManager.UpdateIsRead(MaxId);
      }
      

  4.   


    上面是一个ID为messageSession1的DIV
     <script type="text/javascript" language="javascript">  
      function <%#this.ClientID%>_CallBack(){    
        <%# Page.ClientScript.GetCallbackEventReference( this, "", this.ClientID + "_GetResult", "")%>;    
      }
      
      function <%#this.ClientID%>_GetResult(result){
        if(result!="")
        {
          document.getElementById("messageSession1").innerHTML+=result;     
          document.getElementById("messageSession1").scrollTop +=99999999;          
        }
      }    
      i=window.setInterval("<%#this.ClientID%>_CallBack()",1000);  
      </script>