开发者

Disabling Tool tip of the controls

开发者 https://www.devze.com 2023-01-01 01:16 出处:网络
I am using one DataGrid with templatecolumn of Asp:Label Control. In Design Page i used Tool tip for this control, But in the ItemDatabound event, it will checks the number of characters of the text o

I am using one DataGrid with templatecolumn of Asp:Label Control. In Design Page i used Tool tip for this control, But in the ItemDatabound event, it will checks the number of characters of the text of this label. If the character is less than 40, i have to disable the tooltip for that control only.. But i couldn't finalize this task. How it will be done? Please help me. Than开发者_开发百科ks in advance..


Assuming the label is the first cell in the DataGrid. If not, you'll need to change the number in Cells[0].

  void R1_ItemDataBound(Object sender, DataGridItemEventArgs e)
  {

      if (e.Item.ItemType == ListItemType.Item || 
          e.Item.ItemType == ListItemType.AlternatingItem) 
         {

             if(e.Item.Cells[0].Text.Length <= 40){
                 e.Item.Cells[0].Text = String.Empty;
             }
         }
  }
0

精彩评论

暂无评论...
验证码 换一张
取 消