This is a migrated thread and some comments may be shown as answers.

About maintenance tooltip on grid cell

1 Answer 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff Tang
Top achievements
Rank 1
Jeff Tang asked on 14 Aug 2008, 02:44 AM

private void CreateToolTip()
 {
  GridDataItem DataItem;
  
  int iPageIndex = rgSNLoc.CurrentPageIndex;
  int iPageSize = rgSNLoc.MasterTableView.PageSize;
  int iFactor = iPageIndex * iPageSize;

  for (int i = iFactor; i < rgSNLoc.MasterTableView.Items.Count + iFactor; i++)
  {
   DataItem = rgSNLoc.MasterTableView.Items[i - iFactor] as GridDataItem;  

   if (sMultiAddr[i].Length == 1)
   {
    DataItem["loc_name"].ToolTip = sMultiAddr[i][0];
   }
   else
   {
    for (int j = 0; j < sMultiAddr[i].Length; j++)
    {
     if (j == sMultiAddr[i].Length - 1)
      DataItem["loc_name"].ToolTip = sMultiAddr[i][j];
     else
      DataItem["loc_name"].ToolTip = sMultiAddr[i][j] + "\n\n";
    }
   }
  }
 }

I wrote the above function and put it in the "PreRender" event handler of the RadGrid. What I want to do is to assign a unique tooltip to each row of a specified column in the grid, and the tooltip will still exist correctly even the user change the page size or switch to another page of the grid dynamically. However, if the user sort on a column, the value of the tooltips will become wrong. So how can I keep the tooltips correctly in this case? Thanks.

And I also have a question about DateTimePicker. Is there any function can validate the format of the input date? The problem is that even I type this "abcde" in the input area of the DateTimePicker, it still let me go when I out-focus the DateTimePicker. Thanks.

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 18 Aug 2008, 01:09 PM
Hello Jeff,

When the control is sorted, the PreRender event handler will be raised again. This allows you to re-assign the tooltips to the new items accordingly.
As for the DateTimePicker, you can use the client api of the control, to validate the user input - the OnDateSelected client side handler, or the OnValueChanged client side of the input of the picker.

Greetings,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Jeff Tang
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or