ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ASPxGridView--Grid Rows

ASPxGridView--Grid Rows

原创 Linux操作系统 作者:fangqm 时间:2010-09-27 20:03:29 0 删除 编辑
交替改变行的颜色
Styles.AlternatingRow.Enabled 设为 true .
 
像这种效果
 <Columns>
             <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                 <HeaderTemplate>
                     <input type="checkbox" onclick="grid.SelectAllRowsOnPage(this.checked);" title="Select/Unselect all rows on the page" />
                 HeaderTemplate>
                 <HeaderStyle. HorizontalAlign="Center" />
             dxwgv:GridViewCommandColumn>
2.如何得到选择行的值
在SelectionChanged client-side事件中 
 GetSeletedFieldValues() 获取选择字段的值
 GetSelectedRowCount()获取选择记录总个数
如果想在代码中获取己选择的终端项的某字段值
ASPxGridView2.GetSelectedFieldValues("字段")得到的是泛型List
举例,我想在代码中获取己选项中终端号和序列号的值
for (int i = 0; i <  ASPxGridView2.Selection.Count;  i++)
        {  //循环所有己选项
            string termno = Convert.ToString(ASPxGridView2.GetSelectedFieldValues("termNO")[i]);
            string sn = Convert.ToString(ASPxGridView2.GetSelectedFieldValues("sn")[i]);
          //这样就可以得到所有己选项中,想要的字段的值了;
        }
如果没有使用CHECKBOX,而采用高亮显示点击的行FocusedRow,后代要获取高亮行某一字段的值,可以这样
Convert.ToString(ASPxGridView3.GetDataRow(ASPxGridView3.FocusedRowIndex)["字段"]);意思获取指定行()的字段的值
 
/################获取ASPxGridview某行字段数据################
this.ASPxGridView1.GetRowValues(列的索引.VisibleIndex, new string[] {"列字段名"});
###########################################################
 
3如果想实现鼠标移到某一行时改变该行的背景色方法和Gridview一样,只不过这里是的事件是 protected void ASPxGridView1_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e)
    {
        //        //当鼠标停留时更改背景色
               e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
        //        //当鼠标移开时还原背景色
               e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
    }

2010-09-27_205010.jpg

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23109131/viewspace-674962/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
创业项目 https://u.rscode.cn

注册时间:2010-03-24

  • 博文量
    297
  • 访问量
    784646