Hello I can't find how to programmatically add controls into a RadCollapsibleControl
From the documentation I thought I should add to the
CollapsiblePanelLayoutElement
But I do not find access to this element.
Thanks in advance
Pierre-Jean
I am trying to export a RadGridView to excel and running into a few hiccups. I've been able to to work around these but would like to know if there is a better approach I could/should take.
1.) When exporting to excel the RadGridView seems to only support .xls extension rather than .xlsx. These means the first time the user opens the file in excel they get prompted to reformat and re-save. To work around this currently I am using excel interop to open the file in the back ground and re-save it as .xlsx.
Is there a way to save it directly as a .xlsx?
2.) The export method of the RadGridView appears to only support saving directly to a file.
Can the export be streamed so that it is opened with out having to create a temp file so that when saved the user is forced to select a save location and name (this may be more of an issue with excel rather than telerik)?
3.) I did not see an option to be able to export and preserve pinned columns and pinning the headers in the excel file, currently doing this using excel interop.
Is there a way to export with pinned columns pinned in the excel file and pinning the header row?
Below is the approach I am currently taking to accomplish the above would like to be able to clean it up if there are any built in options.
public
static
void
ExportToExcel(
this
RadGridView grid)
{
Microsoft.Office.Interop.Excel.Application excel =
null
;
Workbooks wbs =
null
;
Workbook wb =
null
;
Sheets sheets =
null
;
Worksheet sheet =
null
;
Window activeWindow =
null
;
var fileName =
string
.Format(
"{0}-{1}"
,
"SoftproExtract"
, DateTime.Now.ToString(
"yyyyMMdd-hhmmss"
));
var extension =
"xls"
;
string
tempPath =
string
.Format(
"{0}{1}.{2}"
, Path.GetTempPath(), fileName, extension);
string
userPath =
string
.Empty;
try
{
var exporter =
new
ExportToExcelML(grid) { HiddenColumnOption = HiddenOption.DoNotExport, HiddenRowOption = HiddenOption.DoNotExport, ExportVisualSettings =
true
, SummariesExportOption = SummariesOption.DoNotExport };
exporter.RunExport(tempPath);
excel =
new
Microsoft.Office.Interop.Excel.Application { Visible =
false
, Interactive =
false
};
excel.DefaultFilePath =
""
;
wbs = excel.Workbooks;
wb = wbs.Open(tempPath);
sheets = wb.Sheets;
sheet = sheets[1];
sheet.Activate();
activeWindow = excel.ActiveWindow;
activeWindow.SplitRow = 1;
activeWindow.SplitColumn = grid.Columns.Count(x => x.PinPosition == PinnedColumnPosition.Left);
activeWindow.FreezePanes =
true
;
extension =
"xlsx"
;
userPath =
string
.Format(
"{0}\\{1}.{2}"
, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), fileName, extension);
wb.SaveAs(userPath, XlFileFormat.xlWorkbookDefault);
}
catch
(Exception ex)
{
ex.WriteLog();
ex.Show();
}
finally
{
if
(wb !=
null
)
wb.Close();
if
(excel !=
null
)
excel.Quit();
Marshal.ReleaseComObject(activeWindow);
Marshal.ReleaseComObject(sheet);
Marshal.ReleaseComObject(sheets);
Marshal.ReleaseComObject(wb);
Marshal.ReleaseComObject(wbs);
Marshal.ReleaseComObject(excel);
if
(File.Exists(tempPath))
File.Delete(tempPath);
}
if
(File.Exists(userPath))
Process.Start(userPath);
}
I have a RadForm with RadCollapsiblePanel docked left and a RadStatusStrip on bottom docked.
How is it possible to dock/fix the Statusbar complete on bottom and dock the CollapsiblePanel on the StatusBar?
The CollapsiblePanel is always left to the StatusBar and resize it.
Hi,
I want the user to be able to insert a new item in the combobox (via the underlying TextBoxEditor).
When entered, the user should see the newly added item as selected in the combobox.
I'm probably missing an event or not making the add/set DataSource at the good place.
I'm doing everything in the CellEndEdit event handler of the grid.
Reproduce: double-click on "Type 1", type any text and change the column.
If you re-open the content of the combo, the new item is there
public
partial
class
RadForm1 : Telerik.WinControls.UI.RadForm
{
private
List<KeyValuePair<
string
,
string
>> _list;
public
RadForm1()
{
InitializeComponent();
this
.Load += RadForm1_Load;
radGridView1.CellEndEdit += RadGridView1_CellEndEdit;
}
private
void
RadForm1_Load(
object
sender, EventArgs e)
{
_list =
new
List<KeyValuePair<
string
,
string
>>();
_list.Add(
new
KeyValuePair<
string
,
string
>(TestType.type_1.ToString(),
"Type 1"
));
_list.Add(
new
KeyValuePair<
string
,
string
>(TestType.type_2.ToString(),
"Type 2"
));
_list.Add(
new
KeyValuePair<
string
,
string
>(TestType.type_3.ToString(),
"Type 3"
));
SetColumnDataset();
LoadData();
}
private
void
SetColumnDataset()
{
var comboColumn = radGridView1.Columns[
"columnCombo"
]
as
Telerik.WinControls.UI.GridViewComboBoxColumn;
if
(comboColumn !=
null
)
{
comboColumn.DropDownStyle = RadDropDownStyle.DropDown;
comboColumn.DataSource = _list;
comboColumn.DisplayMember =
"Value"
;
// name to show
comboColumn.ValueMember =
"Key"
;
// name of element of Guid of specific service
}
}
private
void
LoadData()
{
radGridView1.Rows.Clear();
GridViewDataRowInfo rowInfo =
new
GridViewDataRowInfo(
this
.radGridView1.MasterView);
rowInfo.Cells[
"columnCombo"
].Value = Guid.NewGuid().ToString();
rowInfo.Cells[
"columnCombo"
].Value = TestType.type_3.ToString();
radGridView1.Rows.Add(rowInfo);
rowInfo =
new
GridViewDataRowInfo(
this
.radGridView1.MasterView);
rowInfo.Cells[
"columnCombo"
].Value = Guid.NewGuid().ToString();
rowInfo.Cells[
"columnCombo"
].Value = TestType.type_1.ToString();
radGridView1.Rows.Add(rowInfo);
}
void
RadGridView1_CellEndEdit(
object
sender, GridViewCellEventArgs e)
{
// e.ActiveEditor.GetType()
if
(e.Column == radGridView1.Columns[
"columnCombo"
])
{
if
(e.Value !=
null
&& e.Value.ToString() != String.Empty)
{
TestType enumVal;
bool
isEnum = Enum.TryParse<TestType>(e.Value.ToString(),
out
enumVal);
if
(isEnum)
{
// enumVal holds the value
}
else
{
AddNewColumnItem(Guid.NewGuid().ToString());
}
}
else
{
AddNewColumnItem(Guid.NewGuid().ToString());
}
}
}
private
void
AddNewColumnItem(
string
name)
{
if
(!_list.Any(x => x.Key == name))
{
_list.Add(
new
KeyValuePair<
string
,
string
>(name,
string
.Format(
"Type {0}"
, name)));
SetColumnDataset();
}
}
}
public
enum
TestType
{
type_1,
type_2,
type_3
}
I add RadCollapsiblePanel programmaticly to a form (Dock Top).
Is it possible to change the order of the CollapsiblePanel via Drag&Drop?
An alternative could be 2 Buttons (Up/Down) but D&D will be the best solution.
//This doesn't work
MultiColumnComboBox.SelectedValue = 1;
//This is the correct way of seeting the value
MultiColumnComboBox.SelectedValue =
"1"
;
//Another way
MultiColumnComboBox.SelectedValue = Convert.ToInt32(intValue).ToString();
Hi there,
I'm using the RadRichTextEditor the first time and I'm wondering if it is somehow possible to get only the HTML out of the editor. I've thought about something like:
1.
string
htmlText = txtText.Text;
// while txtText is my RadRichTextEditor
1.
HtmlFormatProvider prov =
new
HtmlFormatProvider();
2.
string
htmlText = prov.Export(txtText.Document);
1.
string
htmlText =
"This is a <b>bold</b> text. Great, isn't it?"
I have a simple test Form with just the RadWebCam control on it. When you first open the form, the camera runs at about 10-15fps. Once you take a snapshot it seems to move up fps.(v4.0.30319 - Win10, I7vPro, 16Ram)
Why does it shut the camera off every time you take a snapshot? How can I use it to capture multiple images one after another if it shuts the camera off and displays the image in the viewer after every snapshot?