单行
this.dataGrid1.CurrentCell.RowNumber ;
选中行
this.dataGrid1.Select(ndex);

解决方案 »

  1.   

    可以加入一个有check的摸版列,然后
    for(int i=DataGrid1.Items.Count-1;i>-1;i--)
    {
    CheckBox CheckBox_sel = (CheckBox) DataGrid1.Items[i].FindControl("CheckBox_");

    if(CheckBox_sel.Checked)
    {
    ...
    }
    }
      

  2.   

    楼上,我想能达到windows风格的效果,就是按住ctrl键然后单击为多选,可以实现吗?
      

  3.   

    要达到windows风格的效果,就是按住ctrl键然后单击为多选,可以实现吗?
      

  4.   

    public int[] getSelect()
    {
    ArrayList temp=new ArrayList();
    for(int i=0;i<this.ListManager.Count;i++)
    if(this.IsSelected(i))
    temp.Add(i);
    int rows=new int[temp.Count];
    for(int i=0;i<temp.Count;i++)
    rows[i]=temp[i].ToString();
    return rows;
    }
      

  5.   

    <ItemTemplate>
    <input  type="checkbox" id="chk" name="chk" 
    value='<%# Container.DataItem("FREINVKEY") %>' >
    </ItemTemplate>
    然后用javascript去取,
    var aa =document.all.chk
    如果只有一条就可以直接取value,如果多条就aa[i].value
      

  6.   

    看的好奇怪,是windows控件,还是web服务器控件,好像什么都有
      

  7.   

    windows窗体的dataGrid控件,想实现多选,选中的记录高亮显示,并且我能知道这些记录的行号。
      

  8.   

    DataGrid的默认就是可以选择多行呀。
    在DataGrid的MouseUp事件中写下如下的代码就可以显示你所选择的行号了:
    if (e.Button == MouseButtons.Left)
    {
    DataGrid.HitTestInfo hti = this.dataGrid1.HitTest(new Point(e.X, e.Y)); 
    if(hti.Type == DataGrid.HitTestType.RowHeader) 
    {
    if(Control.ModifierKeys == Keys.Shift) 
    {
        
    for(int i = 0;i<this.dataGrid1.VisibleRowCount -1;i++)
    {
    if (this.dataGrid1.IsSelected(i))
    MessageBox.Show(i.ToString());
    }
    }
    }
    }
      

  9.   

    如果要高亮显示则可以设置Color属性了。