如题!

解决方案 »

  1.   

    先拖一个下拉条,加载上数据
    然后可以
    dgvStockPlan.controls.Add(zfComboBox1);//zfComboBox1为下拉框,dgvStockPlan是gridView   Rectangle rect = this.dgvStockPlan.GetCellDisplayRectangle(this.dgvStockPlan.CurrentCell.ColumnIndex, this.dgvStockPlan.CurrentCell.RowIndex, false);
                            this.zfComboBox1.Left = rect.Left;
                            this.zfComboBox1.Top = rect.Top;
                            this.zfComboBox1.Width = rect.Width;
                            this.zfComboBox1.Height = rect.Height;
                            this.zfComboBox1.Visible = true;
    在gridView里重新绘制它
      

  2.   

    首先我要说的是在WEB中好像真的是没有datagrid控件。常用的我只知道3个。GirdView,Repeater,DataList
    这3个都能实现根据数据下拉
      

  3.   

    Datagrid 外面加个Div就可以了<div style="width:1024px;height:300px;overflow:auto;">
    ....DataGrid
    </div>--------
    再不行的话,你就要自己重写一个自定义的DataGrid了。前面这个方法我个人认为是最简单的。
      

  4.   

    这个是让表头不动的HTML原代码。因为DataGrid这个控件我不常在vs2008中用,所有到时候你自己Code一下就行<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>  
    <style type="text/css">  
    <!--  
    body {  
    background: #FFF;  
    color: #000;  
    font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif;  
    margin: 10px;  
    padding: 0  
    }  table, td, a {  
    color: #000;  
    font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif  
    }  .td  
    {  
    nowrap:’’true’’;  
    }  div.tableContainer {  
    border: 1px solid #963;  
    height: 185px;  
    overflow: auto;  
    width: 100%;  
    }  /* WinIE 6.x needs to re-account for it’’s scrollbar. Give it some padding */  
    \html div.tableContainer/* */ {  
    padding: 0 16px 0 0  
    }  
    /* define width of table. IE browsers only */  
    /* if width is set to 100%, you can remove the width */  
    /* property from div.tableContainer and have the div scale */  
    div.tableContainer table {  
    float: left;  
    width: 100%  
    }  /* WinIE 6.x needs to re-account for padding. Give it a negative margin */  
    \html div.tableContainer table/* */ {  
    margin: 0 -16px 0 0  
    }  
    /* set table header to a fixed position. WinIE 6.x only */  
    /* In WinIE 6.x, any element with a position property set to relative and is a child of */  
    /* an element that has an overflow property set, the relative value translates into fixed. */  
    /* Ex: parent element DIV with a class of tableContainer has an overflow property set to auto */  
    thead.fixedHeader tr {  
    position: relative;  
    /* expression is for WinIE 5.x only. Remove to validate and for pure CSS solution */  
    top: expression(document.getElementById("tableContainer").scrollTop)  
    }   /* make the TH elements pretty */  
    thead.fixedHeader th {  
    background: #C96;  
    border-left: 1px solid #EB8;  
    border-right: 1px solid #B74;  
    border-top: 1px solid #EB8;  
    font-weight: normal;  
    padding: 4px 3px;  
    text-align: center  
    }  /* make the A elements pretty. makes for nice clickable headers */  
    thead.fixedHeader a, thead.fixedHeader a:link, thead.fixedHeader a:visited {  
    color: #FFF;  
    display: block;  
    text-decoration: none;  
    width: 100%  
    }  /* make the A elements pretty. makes for nice clickable headers */  
    /* WARNING: swapping the background on hover may cause problems in WinIE 6.x */  
    thead.fixedHeader a:hover {  
    color: #FFF;  
    display: block;  
    text-decoration: underline;  
    width: 100%  
    }  /* make TD elements pretty. Provide alternating classes for striping the table */  
    /* http://www.alistapart.com/articles/zebratables/ */  
    tbody.scrollContent td, tbody.scrollContent tr.normalRow td {  
    background: #FFF;  
    border-bottom: 1px solid #EEE;  
    border-left: 1px solid #EEE;  
    border-right: 1px solid #AAA;  
    border-top: 1px solid #AAA;  
    padding: 2px 3px  
    }  tbody.scrollContent tr.alternateRow td {  
    background: #EEE;  
    border-bottom: 1px solid #EEE;  
    border-left: 1px solid #EEE;  
    border-right: 1px solid #AAA;  
    border-top: 1px solid #AAA;  
    padding: 2px 3px  
    }  
    -->  
    </style>  
    </head><body>  
    <div id="tableContainer" class="tableContainer" style="width:900px;">  
    <table border="0" cellpadding="0" cellspacing="0" width="100%" class="scrollTable">  
    <thead class="fixedHeader">  
    <tr>  
    <th><a href="#">Header 1</a></th>  
    <th><a href="#">Header 2</a></th>  
    <th><a href="#">Header 3</a></th>  
    <th><a href="#">Header 4</a></th>  
    <th><a href="#">Header 5</a></th>  
    <th><a href="#">Header 6</a></th>  
    <th><a href="#">Header 7</a></th>  
    </tr>  
    </thead>  
    <tbody class="scrollContent">  
    <tr>  
    <td>Cell Content 1</td>  
    <td>Cell Content 2</td>  
    <td>Cell Content 3</td>  
    <td>Cell Content 4</td>  
    <td>Cell Content 5</td>  
    <td>Cell Content 6</td>  
    <td>Cell Content 7</td>  
    </tr>  
    <tr>  
    <td>More Cell Content 1</td>  
    <td>More Cell Content 2</td>  
    <td>More Cell Content 3</td>  
    <td>More Cell Content 4</td>  
    <td>More Cell Content 5</td>  
    <td>More Cell Content 6</td>  
    <td>More Cell Content 7</td>  
    </tr>  
    <tr>  
    <td nowrap>Even More Cell Content 1 Even More Cell Content Even More Cell Content </td>  
    <td nowrap>Even More Cell Content 2</td>  
    <td nowrap>Even More Cell Content 3</td>  
    <td nowrap>Even More Cell Content 4</td>  
    <td nowrap>Even More Cell Content 5</td>  
    <td nowrap>Even More Cell Content 6</td>  
    <td nowrap>Even More Cell Content 7</td>  
    </tr>  
    <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr> 
    <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr>  
    <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr> <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr>  
    <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr>  
    <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr>  
    <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr>  
    <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr>  
    <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr>  <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr>  
    <tr>  
    <td>And Repeat 1</td>  
    <td>And Repeat 2</td>  
    <td>And Repeat 3</td>  
    <td>And Repeat 4</td>  
    <td>And Repeat 5</td>  
    <td>And Repeat 6</td>  
    <td>And Repeat 7</td>  
    </tr>  
    </tbody>  
    </table>  
    </div>  
    </body></html> 
      

  5.   

    一般我都是用GridView+DropDownList来实现。
    如果你是初学者。建议你用SqlDataSource控件来配置数据源。实现起来很简单。
    GridView里添加类型为TemplateField列。
    代码如下:
    <asp:GridView ID="GridView1" runat="server">
            <asp:TemplateField HeaderText="【下拉条】页眉名称">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="DropDownList1" runat="server" DataSource='【绑定的SqlDataSource数据源】这里可以在【设计】模式下手动添加'>
                                        </asp:DropDownList>

                                    </ItemTemplate>
            </asp:TemplateField>
    </asp:GridView>不知道您看懂了没
      

  6.   

    意思是跟WinFORM的DATAGRIDVIEW样的数据多了直接由个下拉条?