Hello
I wanted to know:
1) When I open the demo project with VS 2008 Professional Edition with SP1, VS crashes.any ideas? I'm using vista sp1, + telerik 2008 q3. I tried running vs with admin but didn't help
2) What's the name of the left control in the demo app(which lists particular control's demos)? It looks like treeview, but I liked it's effects and want to use it in my application. Thanks.
| private void ReselectTreeViewSelection() |
| { |
| if (PlansTreeView.SelectedItem == null) |
| return; |
| var initialSelection = PlansTreeView.SelectedItem; |
| // find the master for the current selection |
| var selectedMaster = initialSelection as MasterRetailPlan; |
| if (selectedMaster == null) |
| { |
| var selectedTier = initialSelection as TierRetailPlan; |
| if (selectedTier != null) |
| selectedMaster = selectedTier.Master; |
| else |
| { |
| var selectedPub = (PublicationRetailPlan)initialSelection; |
| selectedMaster = selectedPub.Tier.Master; |
| } |
| } |
| // find the matching master whether placeholder or otherwise |
| var master = PlansTreeView.Items.Cast<MasterRetailPlan>().Single(x => x.ToString() == selectedMaster.Name || x.Name == selectedMaster.Name); |
| _masterContainer = PlansTreeView.ContainerFromItemRecursive(master); |
| // if the selected item was a master, then we're done |
| if (selectedMaster == initialSelection) |
| _masterContainer.IsSelected = true; |
| else |
| // we know we haven't found the selected item yet, so we expand the master |
| // and dig in to the tiers as soon as the ItemContainers for the tiers have been created |
| // we do this because the containers won't be created until needed, i.e. until the parent is expanded |
| _masterContainer.ItemContainerGenerator.StatusChanged += MasterContainerGenerator_StatusChanged; |
| _masterContainer.IsExpanded = true; |
| } |
| void MasterContainerGenerator_StatusChanged(object sender, EventArgs e) |
| { |
| // don't do anything until the containers are generated |
| var generator = sender as ItemContainerGenerator; |
| if (generator.Status != GeneratorStatus.ContainersGenerated) |
| return; |
| // find the tier for the current selection |
| var initialSelection = PlansTreeView.SelectedItem; |
| var selectedTier = initialSelection as TierRetailPlan; |
| if (selectedTier == null) |
| { |
| var selectedPub = initialSelection as PublicationRetailPlan; |
| if (selectedPub != null) |
| selectedTier = selectedPub.Tier; |
| } |
| // find the matching tier |
| var tier = _masterContainer.Items.Cast<TierRetailPlan>().Single(x => x.Name == selectedTier.Name); |
| _tierContainer = PlansTreeView.ContainerFromItemRecursive(tier); |
| // if the selected item was the tier, then we're done |
| if (selectedTier == initialSelection) |
| _tierContainer.IsSelected = true; |
| else |
| // we know the tier wasn't the selected item, so it must be a pub |
| // we expand the tier and examine the pubs as soon as their ItemContainers have been created |
| _tierContainer.ItemContainerGenerator.StatusChanged += TierContainerGenerator_StatusChanged; |
| _tierContainer.IsExpanded = true; |
| } |
| void TierContainerGenerator_StatusChanged(object sender, EventArgs e) |
| { |
| // don't do anything until Generated |
| var generator = sender as ItemContainerGenerator; |
| if (generator.Status != GeneratorStatus.ContainersGenerated) |
| return; |
| // we know if this fired, then the selected item was a pub |
| var selectedPub = (PublicationRetailPlan)PlansTreeView.SelectedItem; |
| var pub = _tierContainer.Items.Cast<PublicationRetailPlan>().Single(x => x.Name == selectedPub.Name); |
| var pubContainer = PlansTreeView.ContainerFromItemRecursive(pub); |
| pubContainer.IsSelected = true; |
| } |
| private void PlansTreeView_Expanded(object sender, RadRoutedEventArgs e) |
| { |
| var item = (RadTreeViewItem)e.OriginalSource; |
| var tier = (item.DataContext as TierRetailPlan); |
| if (tier == null) |
| return; |
| if (item.Items.SortDescriptions.Count == 0) |
| item.Items.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); |
| } |
gv.ExportSettings.FileName = getFileName();
gv.ExportSettings.ExportOnlyData = true;
gv.ExportSettings.IgnorePaging = true;
gv.ExportSettings.OpenInNewWindow = true;
gv.MasterTableView.Style["text-align"] = "left";
gv.MasterTableView.ExportToExcel();
The problem: text-align of data in cells in excel file is different! One column aligned left, other - right. But in radGrid all aligned left.
I tried set style gv.MasterTableView.Style["text-align"] = "left"; but this doesn't solve my problem.
How can I set style for table cells???
P.S.
I found on the forum screenshot of excel table with a similar problem (last column aligned left and other right):
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/export-to-excel-number-problems.aspx
Thanks a lot.