操作List View(添加tooltip到List View的列头)

本文详细介绍了如何订阅Controller的ViewControlsCreated事件以访问ListView的grid控制设置,包括为GridView列添加提示文本。
  • Since you are going to access the settings of the List View's grid control, you need to ensure it has already been created. That's why you need to subscribe to the Controller's ViewControlsCreated event. 

    using DevExpress.Web.ASPxGridView;
    using DevExpress.ExpressApp.Web.Editors.ASPx;
    //...
    private void WebTooltipController_ViewControlsCreated(object sender, EventArgs e) {
        ASPxGridListEditor listEditor = ((ListView)View).Editor as ASPxGridListEditor;
        if (listEditor != null) {
            foreach (GridViewColumn column in listEditor.Grid.Columns) {
                if ((column as GridViewDataColumnWithInfo) != null)
                    column.ToolTip = "Click to sort by " + column.Caption;
            }
        }
    }