zoukankan      html  css  js  c++  java
  • AspxGridView自定义列CustomColumnDisplayText事件与GridView中的rowdatabound事件一样

     protected void ASPxGridView1_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e)
        {
            if (e.Column.VisibleIndex == 8)
            {
                string users= e.GetFieldValue ("account").ToString();
                string str_right = "select product_right from tbl_admin where account='"+users +"'";
                SqlDataReader dr = co.storereadershop(str_right );
                if (dr.Read())
                {
                    e.DisplayText = dr[0].ToString();
                }
                
            }
    
        }
    
    
    
    
    
    AspxGridView中根据判断隐藏某个值的事件
    OnCustomColumnDisplayText="Grid_CustomColumnDisplayText"
    中放一列普通列
      <dxgw:GridViewDataTextColumn Caption="操作" VisibleIndex="7" Width="28px" HeaderStyle-HorizontalAlign="Center">                    
     </dxgw:GridViewDataTextColumn> 
    ----------------------------------------- 
    方法
     protected void Grid_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e)
        {
            if (e.Column.VisibleIndex == 7)
            {
    //如果ItemType等于1显示超链接,不等于1不显示
                if (e.GetFieldValue("ItemType").ToString().Equals("1"))
                {
                    e.DisplayText = "<a href=\"javascript:void(0);\" onclick=\"OnSetRuleClick(this,'" + e.GetFieldValue("ItemID") + "')\">设置规则</a>";
                }
                else
                {
                    e.DisplayText = "";
                }
            }
        }
    --------------------------
    超链列
     <dxwgv:GridViewDataColumn Caption="标题" VisibleIndex="1" HeaderStyle-HorizontalAlign="Center"
                        Width="50%">
                        <Settings AllowSort="False" />
                        <EditFormSettings Visible="False"  />
                        <DataItemTemplate>
                            <a href="javascript:void(0);" onclick="OnMoreInfoClick(this,'<%# Container.KeyValue %>')">
                                <%#Eval("Title")%></a>
                        </DataItemTemplate>
                        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                    </dxwgv:GridViewDataColumn>
    
  • 相关阅读:
    python time 转换&运算tips
    Web.py session用户认证
    简单的内存池实现gko_alloc
    cpp(第十章)
    cpp(第九章)
    cpp(第八章)
    cpp(第七章)
    cpp(第六章)
    cpp(第五章)
    结构中的位字段
  • 原文地址:https://www.cnblogs.com/xiaofengfeng/p/2034647.html
Copyright © 2011-2022 走看看