Dim SchedElement As SchedulerDayViewGroupedByResourceElement = RadScheduler1.GetDayView.Scheduler.SchedulerElement.ViewElement
SchedElement.Font = New Font("Segoe UI", 10, FontStyle.Regular, GraphicsUnit.Point)
SchedElement.ForeColor = Color.White
SchedElement.ResourceHeaderHeight = 35
SchedElement.ResourcesHeader.BackColor = Color.FromArgb(0, 159, 60)
SchedElement.ResourcesHeader.BackColor2 = Color.FromArgb(0, 159, 60)
I have a gridview with a gridviewcheckboxcolumn and an enabled headercheckbox as well. I have Excel type filters enabled along with grouping. What I want to do is get a running count of how many items are checked (say out of 1,000).
Currently I am using a loop to get the checked cells by iterating through the RadGrid.MasterTemplate.DataView.ItemCount and checking each row checkbox value. This works ok, but where I have a problem is with the header check/uncheck all button. When I check the header button it will trigger the CellValueChanged event every time a cell changes. For 1,000 records this gets pretty slow.
So my questions are;
Private
Sub
grdSales_CellValueChanged(sender
As
Object
, e
As
GridViewCellEventArgs)
Handles
grdSales.CellValueChanged
'count checked rows, enable process, set label
If
e.ColumnIndex > 0
Then
Return
'only want checked col [0]
Dim
iCnt
As
Integer
= fCountCheckedRows()
btnProcess.Enabled = iCnt > 0
lblCheckedRecords.Text =
CStr
(lblCheckedRecords.Tag) & iCnt
End
Sub
Private
Function
fCountCheckedRows()
As
Integer
Dim
iCount
As
Integer
= 0
For
i = 0
To
grdSales.MasterTemplate.DataView.ItemCount - 1
If
Not
IsDBNull(grdSales.Rows(i).Cells(0).Value)
Then
If
grdSales.Rows(i).Cells(0).Value =
True
Then
iCount += 1
End
If
Next
Return
iCount
End
Function
In VB.net please,
I need to open the default edit form for a an appointment in MyRadScheduler.Appointments, so I just need to simulate the double click on an appointment, but using only code.
I have an application with multiple PDF viewers and the user can switch between the viewers on demand.
When switching between viewers I do the following:
When this happens, the content of the MemoryStream is not displayed, instead only the placeholder content is shown. It's as though the load of the MemoryStream was never loaded (but I have confirmed that line of code is always reached).
If I remove the placeholder code so that I'm only working with a MemoryStream then it works correctly.
Calling UnloadDocument() before loading from the MemoryStream has no effect.
What can be done to fix this?
How can I limit the length of characters user can enter on a particular gridview column?
I tried this code but I got an error saying that there is no definition for MaxLength?
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
if (e.ColumnIndex == 1)
{
if (e.Column is GridViewTextBoxColumn)
{
((RadTextBoxEditorElement)((RadTextBoxEditor)this.radGridView1.ActiveEditor).EditorElement).MaxLength = 30;
}
}
}
I am new to Telerik controls and am attempting setting up a Scheduler control on a windows form. I have followed the web based sample and am attempting to bind to your sql based sample data using as the ScheduleBindingDataSource data setting the settings as your sample
Does the datasource need to be initiated when the form loads as I am returning no records?
ResourceProvide
Allownew True
Datamember Appointments
DataSource SchedulerDataDataSet
If I comment out the if statement in the data binding event and force a new instance of the SchedulerDataDataSet then the records are returned!
'If Me.SchedulerDataDataSet Is Nothing Then
Me.SchedulerDataDataSet = New SchedulerDataDataSet()
Dim appointmentsAdapter As New AppointmentsTableAdapter()
appointmentsAdapter.Fill(Me.SchedulerDataDataSet.Appointments)
Dim resourcesAdapter As New ResourcesTableAdapter()
resourcesAdapter.Fill(Me.SchedulerDataDataSet.Resources)
Dim appointmentsResourcesAdapter As New TransientAppointmentsResourcesTableAdapter()
appointmentsResourcesAdapter.Fill(Me.SchedulerDataDataSet.TransientAppointmentsResources)
' End If
Hello, Telerik!
For some reason I cannot find my previous thread.
Here is your answer for my previous question:
*****************
Hello Alexander,
Thank you for writing.
Due to the UI virtualization in RadGridView, cell elements are created only for currently visible cells and are being reused during operations like scrolling, filtering, grouping and so on. The CellFormatting event is fired only for the visible cells in the grid. That is why you obtain this unexpected behavior. Note that the CellFormatting event is purposed to customize the cells' style and it is not recommended to change the cell's value in this event. Changing the value of a cell will trigger an update of the current view and thus the CellFormatting event will be fired again. This may lead to any other unexpected behavior. I would recommend you to update the cells' values outside the CellFormatting event handler, e.g. in a RadButton.Click event. Thus, you can iterate the desired rows and for each row, you can change the value for the specific cell.
If it doesn't suit your scenario, it would be greatly appreciated if you can provide additional information about the exact goal that you are trying to achieve. Thus, we would be able to think about a suitable solution and assist you further. Thank you.
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Progress Telerik
*************************
My further questions:
What other events during gridview load you can advise to compute values? RowFormatting will not work too?
If you recommend to compute after gridview load, can you tell me even and should I use Rows collection for iteration?
Greetings. We're considering to adopt your suite of components as a standard for our future applications.
At the moment, I'm trying to understand if your WinForms GridView component behavior suits our current workflow.
Consider the following class structure (Master -> each master has "n" Slaves -> each slave has "k" SubSlaves):
public class MasterEntity
{
public Int32 Id { get; set; }
public String Name { get; set; }
public IList<SlaveEntity> Slaves { get; set; }
}
public class SlaveEntity
{
public Int32 Id { get; set; }
public String PropA { get; set; }
public Decimal PropB { get; set; }
public IList<SubSlaveEntity> SubSlaves { get; set; }
}
public class SubSlaveEntity
{
public Int32 Id { get; set; }
public String PropC { get; set; }
}
I assign the dataSource of the grid to an IList<MasterEntity>: as you can see all the lists involved are generic ILists (not BindingLists) and each class doesn't implement the INotifyPropertyChanged interface.
Following the instructions in this page (http://docs.telerik.com/devtools/winforms/gridview/hierarchical-grid/binding-to-hierarchical-data-automatically), I'm able to display the rows in a proper hierarchical grid (through AutoGenerateHierarchy property). I'm also able to properly configure the layout of each column at each hierarchy level.
Now, what I want to achieve is the following:
When I add/delete/edit a row (at each hierarchy level, Master, Slave or SubSlave) I need the changes to be reflected in the grid, without it scrolling to the top or losing the column layout settings. Of course, since we're using normal Lists (not BindingLists) and the entities doesn't implement INotifyPropertyChanged, I know that the grid must be notified of each operation performed on its datasource. At the moment I've only managed to achieve this when I change a property of an entity at the first hierarchy level (Master):
1.
(radGrid.Datasource as IList<
MasterEntity
>)[0].Name = "NEW NAME";
2.
radGrid.TableElement.Update(GridUINotifyAction.DataChanged);
but I also need this to work when I do the following:
1.
(radGrid.Datasource as IList<
MasterEntity
>).Add(new MasterEntity(){ .. });
2.
-> how to notify the grid about the new master entity?
1.
(radGrid.Datasource as IList<
MasterEntity
>)[0].Slaves[0].PropA = "NEW PROP A VALUE";
2.
-> how to notify the grid about the change in a property value in that slave entity?
1.
(radGrid.Datasource as IList<
MasterEntity
>)[0].Slaves.Add(new SlaveEntity(){ .. });
2.
-> how to notify the grid about the new slave entity in the first master entity?
..and so on, I need to be able to perform ADD / DELETE / CHANGE ENTITY PROPERTIES at each hierarchy level and properly notify the grid about each operation, while keeping the current column layout (at each hierarchy level) and without the grid scrolling to the top.
Thanks for the kind help.
Hi
I used a rad shaped form in my app, and then removed the title bar. but still I'm able to move form (which is totally great; since I don't have to reproduce form movement by mouse events). then I add a label to top of the form to show the 'subject'. when user click and hold to mouse button to move the form, if the label is clicked, form won't move, but if other parts of form get clicked, form will move. my question is How I can set the label button mousedown event (or any other event) to be able to move the form?
Thanks