Telerik Forums
UI for WinForms Forum
2 answers
507 views
Hi,
I have a simple databound grid (grdPermissions) that has one "tinyint" column with possible values of 0, 1, or 2, which stand for Deny, Grant, or Not Set correspondingly.  This column is being added as a GridViewComboBoxColumn and bound to a List as shown in the code below.  The problem is that when the grid is bound and the data displayed, the combobox does not display its data until clicked with the mouse.  The combobox seems to have the correct value set, but shows nothing until clicked.  Also, once the combobox is closed the cell returns to showing nothing.  You can see the behaviour in the attached images; image1 shows the initial display of the grid, image2 shows how the cell displays the value when clicked, image3 shows the cell in another row displays its value but the previously selected combobox in the row above now displays no data.
What might I be doing wrong?

'**** BEGIN CODE ****
Imports Telerik.WinControls.UI
Imports System.Data
Imports System.Data.SqlClient

Public Class frmGroupPerms
    Private Sub somefunction()
        '** the GetGroupPermissions() function retrieves a table with the
        '** following columns
        '**    GroupID  int,
        '**    Name  nvarchar(255),
        '**    Description  nvarchar(255),
        '**    AppPermissionType  nvarchar(30),
        '**    PermValue  tinyint - can be 0, 1, or 2
       
        Dim _groupPermissions As DataTable = GetGroupPermissions(_groupId)
        _ConfigureGrid()
        grdPermissions.DataSource = _groupPermissions
    End Sub

    Private Sub _ConfigureGrid()
        Dim _perms As List(Of ComboItem) = New List(Of ComboItem)
        _perms.Add(New ComboItem(0, "Deny"))
        _perms.Add(New ComboItem(1, "Grant"))
        _perms.Add(New ComboItem(2, "Not Set"))

        Me.grdPermissions.AutoGenerateColumns = False
        Me.grdPermissions.Columns.Clear()
        Me.grdPermissions.Columns.Add(New GridViewTextBoxColumn("GroupId"))
        Me.grdPermissions.Columns.Add(New GridViewTextBoxColumn("Name"))
        Me.grdPermissions.Columns.Add(New GridViewTextBoxColumn("Description"))
        Me.grdPermissions.Columns.Add(New GridViewTextBoxColumn("AppPermissionType"))
        Dim _cmb As New GridViewComboBoxColumn()
        _cmb.Width = 150
        _cmb.Name = "PermValue"
        _cmb.FieldName = "PermValue"
        _cmb.HeaderText = "Permission"
        _cmb.DataSource = _perms
        _cmb.ValueMember = "ItemValue"
        _cmb.DisplayMember = "ItemText"
        Me.grdPermissions.Columns.Add(_cmb)
    End Sub

    Private Sub grdPermissions_DataBindingComplete(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewBindingCompleteEventArgs) Handles grdPermissions.DataBindingComplete
        grdPermissions.MasterTemplate.Columns("GroupId").IsVisible = False
        grdPermissions.MasterTemplate.Columns("Name").Width = 150
        grdPermissions.MasterTemplate.Columns("Description").Width = 150
        grdPermissions.MasterTemplate.Columns("AppPermissionType").Width = 200
    End Sub
End Class

Friend Class ComboItem
    Public Property ItemText As String
    Public Property ItemValue() As Short

    ''' <summary>
    ''' Initializes a new instance of the ComboItem class.
    ''' </summary>
    ''' <param name="itemValue"></param>
    ''' <param name="itemText"></param>
    Public Sub New(ByVal itemValue As Short, ByVal itemText As String)
        Me.ItemValue = itemValue
        Me.ItemText = itemText
    End Sub
End Class
'**** END CODE ****
Stefan
Telerik team
 answered on 23 Mar 2011
7 answers
142 views
Hello.

I have following situation: I have two grids and I need to some synchronize rows between them.
Synchronization implemented by sorting rows by some field, say syncId: if two rows must be synchronized
then I find the  highest syncId, increase it and assign to them. So the new synchronized rows is moved to
the top of grid. When I  add new rows (AddNewRowPosition = Bottom) there are blinking because it first tries to sort  new added row.
And also there is problem when removing rows when sorting is enabled - it select not the next row before deleted, but jumps higher,
beacuse added rows have the same syncId, say  -1, and when I delete one of the rows it jumps to the first row with syncId = -1. Not very good for usability. So is there any mechanism to suppress sorting while adding and removing rows.

Any thoughts?
Julian Benkov
Telerik team
 answered on 23 Mar 2011
3 answers
128 views

I want to run separate query in each grid view, these grids is located in deferent taps that was created via dock…

Is that possible in rad grid view for win form?

The information I need to add is retrieved from the same DB

Richard Slade
Top achievements
Rank 2
 answered on 23 Mar 2011
2 answers
147 views
string[] strArr = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "A", "B", "C", "D", "E", "F", "21", "22", "23", "24", "25", "26", "27", "2", "3", "4", "5", "6", "7", "8", "9", "10", "A", "B", "C", "D", "2", "3", "4", "5", "6", "7", "8", "9", "10", "A", "B", "C", "D", "2", "3", "4", "5", "6", "7", "8", "9", "10", "A", "B", "C", "D", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
 
private void CreateColumnRow()
        {
            DataTable data = new DataTable();
            data.Columns.Add("1");
            data.Columns.Add("2");
            data.Columns.Add("3");
            data.Columns.Add("4");
            data.Columns.Add("5");
             
            for (int i = 0; i < strArr.Length / 5; i++)
            {
                DataRow dr = data.NewRow();
                data.Rows.InsertAt(dr, 0);
            }
            int intSub = strArr.Length % 5;
            if (intSub > 0)
            {
                DataRow dr = data.NewRow();
                data.Rows.InsertAt(dr, 1);
            }
 
            radGridView1.DataSource = data;
 
            radGridView1.Columns[0].Width = 100;
            radGridView1.Columns[1].Width = 100;
            radGridView1.Columns[2].Width = 100;
            radGridView1.Columns[3].Width = 100;
            radGridView1.Columns[4].Width = 100;
        }
  
private void Form1_Load(object sender, EventArgs e)
        {
              
            CreateColumnRow();
            loadCheckBox();
  
        }
  
private void loadCheckBox()
{
      int z = 0;
      for (int i = 0; i < radGridView1.RowCount; i++)
            {
                for (int j = 0; j < radGridView1.ColumnCount; j++)
                {
                    radGridView1.Rows[i].IsCurrent = true;
                    radGridView1.Columns[j].IsCurrent = true;
                    if (radGridView1.CurrentColumn.Index == j && radGridView1.CurrentRow.Index == i)
                    {
                        RadCheckBoxElement check = null;
                        if (radGridView1.CurrentCell.Children.Count == 0)
                        {
                            check = new RadCheckBoxElement();
                            while (z < strArr.Length)
                            {
  
                                check.Name = "check_" + strArr[z];
                                check.Text = strArr[z];
  
                                radGridView1.CurrentCell.Children.Add(check);
                                z++;
                                break;
                            }
                        }
                        else
                        {
                            check = (RadCheckBoxElement)radGridView1.CurrentCell.Children[0];
                        }
                    }
                    if (z == strArr.Length)
                    {
                        break;
                    }
  
                }
                if (z == strArr.Length)
                {
                    break;
                }
            }
     radGridView1.Rows[0].IsCurrent = true;
     radGridView1.Columns[0].IsCurrent = true;
}

Hello all person in forum!

I send a picture. In picture, i write problem error me. You view my code, you will see code of ( string[] strArr ). If I add ( strArr.lengh < 30 ), this code run OK. Else, it will be problem.

Help me fix it ! Thanks all !
laki
Top achievements
Rank 1
 answered on 23 Mar 2011
3 answers
70 views
Previously I was running the latest 2010 edition of RadControls and had the background color of my TreeViews set to 191 | 219 | 254.  However after updating to Q1 2011, not matter what I set the color to it always shows as white.  I am not sure if this is a bug or if something changed internally.
Richard Slade
Top achievements
Rank 2
 answered on 22 Mar 2011
3 answers
186 views
Hi to everybody.
I have a problem creating a relation between a RadTreeView and a RadGridView.
I add the:
Me.RadTreeViewModelli.RelationBindings.Add(New RelationBinding("ModelloTessuti", Me.TblDBtblDBTessutiBindingSource))

If I bind the tree to a RadListBox the progam works fine, but with a RadGridView the behaviour seems random. Sometimes when I select the node the grid was refresh sometimes not.

Where I wrong?

Alessio
Stefan
Telerik team
 answered on 22 Mar 2011
2 answers
136 views
Hi,

Here is the problem :

I have a binding source (bsCustomers) filled with neccessary data from the database with entity framework.

When i checked the bsCustomers i can see the values are not NULL.
 
My treeview control`s (rtvCustomers) datasource is bsCustomers and I want to assign rtvCustomers.DisplayMember to Name field which is in tbContacts. 

bsCustomer  has --> tbContact.
tbContact has --> Code, Name.

So when i say

this.tvCustomers.RootRelationDisplayName = "Customers";  
this.tvCustomers.DisplayMember = "tbContact.Name";  
thisthis.tvCustomers.DataSource = this.bsCustomers; 

it doesnt work. (In radgridview such assignment ("tbContact.Name") works properly.)

As a solution in NodeCollectionChange

void Nodes_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)  
        {  
            if(e.Action==Telerik.WinControls.Data.NotifyCollectionChangedAction.Add)  
            {  
                if (((RadTreeNode)e.NewItems[0]).Level == 0)  
                    return;  
                ((RadTreeNode)e.NewItems[0]).Text = ((Customer)this.bsCustomers[e.NewStartingIndex]).tbContact.Name;  
            }  
        } 

and it worked. I filled the treeview with customer Names. But i guess there must be another solution.

So is there any other solution to get treeview filled with Names?

Thanks.


Stefan
Telerik team
 answered on 22 Mar 2011
2 answers
103 views
I am using a radtreeview bound to a dataset having multiple levels of hierarchy. See attached file radtreeview.gif.

With AllowEdit=True, I press F2, and edit the text. Then when I hit the enter or escape key, the radtreeview crashes with the an exception "Index -1 does not have a value". See attached file radtreeviewError1.gif

I noticed that this exception is only thrown for the nodes that do not have children. For nodes having children, it works fine.

Also I tried to programmatically edit using a context menu and context menu manager. However the same exception is thrown. My code is pasted below.
-----------------------------------------------------------------------------------------------------------
private void radMenuItemEdit_Click(object sender, EventArgs e)
{
            RadTreeNode node = territoryRadTreeView.SelectedNode;

            if (node != null)
            {
                territoryRadTreeView.AllowEdit = true;
                node.BeginEdit();
            }
        }
-----------------------------------------------------------------------------------------------------------

The version I have is, RadControls for WinForms Q2 2009 SP1.
I am stuck on this issue for the last 2 days and any help will be appreciated.

Thanks
Stefan
Telerik team
 answered on 22 Mar 2011
4 answers
118 views
Hi,

I was just wondering if there was any reason there are no overrides when instantiating a RadTreeNode to set BOTH the TEXT value AND Name Value of the node?

So lets say I wanna create a array of RadTreeNode from some data I have, since there just a constructor having the text (and others but still no NAME property) I have to loop through them to set one by one their name value...


Thanks :)
Stefan
Telerik team
 answered on 22 Mar 2011
2 answers
127 views
Hi!

Working with treeview I encountered some problems:

1. How can i override the default context menu methods (like add and delete)
2. My data structure is a decision tree made out of nodes, where each node has child nodes in an array. Is there an elegant way
   to bind my data structure with the tree view?
Stefan
Telerik team
 answered on 22 Mar 2011
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
NavigationView
VirtualKeyboard
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?