Telerik Forums
UI for WinForms Forum
1 answer
97 views
Hi,
        I am working on rad gridview for winforms. I have a grid with four columns. The first columns is an id field, second column a display field. The third column is a hidden field that has two possible values(lookup, user entry). Based on this the fourth column should show a drop down list or a text box. If the value of the third column is "lookup", we have to get the id value from the id column, query a table with the id and fill the drop down with the resultant values. If the value of the third column is "user entry", we have to show a text box there where user can enter values. Upto this i have done but the problem is, the text box seems to be in locked mode initially when tried to enter data in it. If we try to enter the data after clicking some other columns , then it works fine. I am listing the code below.


public

partial class Test : Form

 

 

{

 

DataTable dtMain;

 

 

 

DataTable dtChild;

 

 

 

public Test()

 

{

InitializeComponent();

SetTableData();

radGridView1.DataSource = dtMain;

}

 

 

private void CreateMainTable()

 

{

dtMain =

 

new DataTable("MainTable");

 

dtMain.Columns.Add(

 

new DataColumn("Id", typeof(System.Int32)));

 

dtMain.Columns.Add(

 

new DataColumn("Desc", typeof(System.String)));

 

dtMain.Columns.Add(

 

new DataColumn("Type", typeof(System.String)));

 

 

}

 

 

private DataTable CreateChildTable()

 

{

dtChild =

 

new DataTable("ChildTable");

 

dtChild.Columns.Add(

 

new DataColumn("Id", typeof(System.Int32)));

 

dtChild.Columns.Add(

 

new DataColumn("Value", typeof(System.String)));

 

 

 

return dtChild;

 

}

 

 

private void SetTableData()

 

{

CreateMainTable();

CreateChildTable();

 

 

DataRow dr = dtMain.NewRow();

 

dr[

 

"Id"] = 1;

 

dr[

 

"Desc"] = "FT Status";

 

dr[

 

"Type"] = "lookup";

 

dtMain.Rows.Add(dr);

dr = dtMain.NewRow();

dr[

 

"Id"] = 2;

 

dr[

 

"Desc"] = "UT Status";

 

dr[

 

"Type"] = "lookup";

 

dtMain.Rows.Add(dr);

dr = dtMain.NewRow();

dr[

 

"Id"] = 3;

 

dr[

 

"Desc"] = "Test";

 

dr[

 

"Type"] = "userentry";

 

dtMain.Rows.Add(dr);

 

 

DataRow childRow = dtChild.NewRow();

 

childRow[

 

"Id"] = 1;

 

childRow[

 

"Value"] = "Test1";

 

dtChild.Rows.Add(childRow);

childRow = dtChild.NewRow();

childRow[

 

"Id"] = 1;

 

childRow[

 

"Value"] = "Test2";

 

dtChild.Rows.Add(childRow);

childRow = dtChild.NewRow();

childRow[

 

"Id"] = 1;

 

childRow[

 

"Value"] = "Test3";

 

dtChild.Rows.Add(childRow);

childRow = dtChild.NewRow();

childRow[

 

"Id"] = 2;

 

childRow[

 

"Value"] = "New1";

 

dtChild.Rows.Add(childRow);

childRow = dtChild.NewRow();

childRow[

 

"Id"] = 2;

 

childRow[

 

"Value"] = "New2";

 

dtChild.Rows.Add(childRow);

}

 

 

private void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)

 

{

 

 

 

}

 

 

private void FillCustomLookupData(GridViewLookUpColumn gridViewLookUpColumn, int customLookupId)

 

{

 

 

if (gridViewLookUpColumn != null)

 

{

 

 

//DataTable dtNew = dtChild.Select("Id=" + Convert.ToString(customLookupId));

 

 

 

DataView dv = dtChild.DefaultView;

 

dv.RowFilter =

 

"Id=" + Convert.ToString(customLookupId);

 

gridViewLookUpColumn.DataSource = dv.ToTable();

gridViewLookUpColumn.UniqueName =

 

"Value";

 

gridViewLookUpColumn.DisplayMember =

 

"Value";

 

gridViewLookUpColumn.DropDownStyle =

 

RadDropDownStyle.DropDownList;

 

}

}

 

 

private void radGridView1_CreateRow(object sender, GridViewCreateRowEventArgs e)

 

{

}

 

 

private void radGridView1_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)

 

{

}

 

 

private void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e)

 

{

 

 

RadTextBoxElement rtxtElement;

 

 

 

if (radGridView1.CurrentRow.Cells["Value"] == null)

 

 

 

return;

 

 

 

GridViewLookUpColumn gridViewLookUpColumn = ((Telerik.WinControls.UI.GridViewLookUpColumn)(radGridView1.CurrentRow.Cells["Value"].ColumnInfo));

 

 

 

if (radGridView1.CurrentRow.Cells["Type"].Value.ToString().Trim() == "lookup")

 

{

FillCustomLookupData(gridViewLookUpColumn,

 

Convert.ToInt32(radGridView1.CurrentRow.Cells["Id"].Value));

 

radGridView1.CurrentRow.Cells[

 

"ValuesBound"].Value = "1";

 

}

 

 

else

 

 

{

rtxtElement =

new RadTextBoxElement();

 

 

 

if (radGridView1.CurrentRow.Cells["Value"].CellElement != null)

 

{

 

 

if (radGridView1.CurrentRow.Cells["Value"].CellElement.Children.Count == 0)

 

{

rtxtElement.TextChanged +=

 

new EventHandler(rtxtElement_TextChanged);

 

radGridView1.CurrentRow.Cells[

 

"Value"].CellElement.Children.Add(rtxtElement);

 

}

radGridView1.CurrentRow.Cells[

 

"ValuesBound"].Value = "1";

 

}

}

}

 

 

void rtxtElement_TextChanged(object sender, EventArgs e)

 

{

 

}

 

 

private void radCheckBox1_Enter(object sender, EventArgs e)

 

{

radCheckBox1.BackColor =

 

Color.Beige;

 

}

 

 

private void radCheckBox1_Leave(object sender, EventArgs e)

 

{

radCheckBox1.BackColor =

 

Color.Red;

 

}

}

 


Please help me to solve this.

Regards
Shamjith T.H



       
Shamjith
Top achievements
Rank 1
 answered on 02 Jan 2009
2 answers
316 views
I am new to RadGrid for WinForm, and have some basic questions:

1.    Upon adding a new row to the grid, I want to write the value in code in one of the 10 cells. I tried by writing this code in the RowChanged event but did not work:  radGridView1.CurrentRow.Cells["WeekNumber"].Value = radSpin1.Value;
How I can achieve this.

2.    I don't want to use spinbutton Editor with a Decimal type column. Please let me know how to change the default Column Editor of a Decimal Type column?

Tariq Changgez

Victor
Telerik team
 answered on 30 Dec 2008
5 answers
158 views
Hello Everyone,

I am using Visual Studio 2008 and telerik rad controls Q3 2008. Inspite of all successful installations when i open my VS 2008 IDE I do not see toolbar with Telerik Controls. I see general microsoft .net toolbars/controls.

Can anyone tell me what I need to do so that I can see all telerik rad controls in a toolbar. I would appreciate any help.

Thank you,

Regards,
GR

jack
Top achievements
Rank 1
 answered on 30 Dec 2008
1 answer
92 views
I have a RadForm Dialog that sometimes does some lengthy operations.
In this case, the Form does not always repaint, is that the expected behaviour?
Do I always have to implement some Worker Thread pattern when working with RadForm?


Deyan
Telerik team
 answered on 30 Dec 2008
3 answers
148 views
Hi

I have Asp.net, WinForms,WPF,Silverlight and Reporting telerik components.

How can I add  Scheduler to my win project. I can't see my toolbax this component? Have a sample application?

Thank you...
Jordan
Telerik team
 answered on 30 Dec 2008
3 answers
146 views

2008/Q1SP1

I have set images to my dockable document forms (UserDockForm based, imported as local resources) and they display nicely in the tab, but not in the drop down menu when the tab area is filled - which I think would be expected.

What am I missing?
Julian Benkov
Telerik team
 answered on 30 Dec 2008
1 answer
116 views
Is there as way to get the RadRibbonbar to behave like the MS Ribbonbar?  The RadRibbonbar appears to have only 2 modes (expanded and not expanded) and when expanded the RadRibonbar uses valuable screen space.  The MS Ribbonbar appears to have a 3rd mode where when the RibbonBar is popped open (single click) as opposed to expanded (double click), and it overlays the underlying form and does not use any screen space.
Deyan
Telerik team
 answered on 30 Dec 2008
5 answers
132 views
Hello Telerik,

I've read the following post: http://www.telerik.com/community/forums/winforms/dock/fixed-size-dockpanels.aspx

It mentions that in the Q2 release something should be implemented having fixed size dock panels.

The following is what I require:

3 dockpanels:
[A]
---
[B]
---
[C]


The height of A and C should be fixed.
the height of B should be filling the remaining space.


How can this quest be accomplished?

Kind regards,
Jack
Julian Benkov
Telerik team
 answered on 30 Dec 2008
2 answers
186 views
I am having trouble finding a solution to this need.  I have a radTabStrip on a form with one tab created at Design time.  This one tab is [Add New] used for adding other tabs.  I need to respond to both Right Click (mousedown) and Double click on the Dynamically created tabs.  This is no problem on the tab created at design time because it is easy to create the event but can't seem to create an event for the dynamic tabs.

The examples I found in the documentation (responding to right click and double click) only deal with design time tabs.  When I use the mouse down and click events for the RadTabStrip itself it respond to clicks on more than just the tabs, but on the control itself.

Any help (guidance) would be appreciated.

I am using VB.net in VS2008.

BTW:  Your controls are great!
Martin Vasilev
Telerik team
 answered on 30 Dec 2008
6 answers
168 views
Hello Telerik Team,

I'd like to know if it would be possible not to show repeated values for any given column when the data is ordered by dat column.
For example, suppose I need to provide a grid wich consist on customers data.
Each customer  could have serveral adresses and several Phone Numbers per address.
A typical view for this information would be like this:

Cust. 1 -- Addr. 1-1 -- Phone1-1
Cust. 1 -- Addr. 1-2 -- Phone1-2
Cust. 1 -- Addr. 1-3 -- Phone1-3
Cust. 2 -- Addr. 2-1 -- Phone2-1
Cust. 2 -- Addr. 2-1 -- Phone2-2

in this case I would like to present it more like a tree:

Cust. 1 -- Addr. 1-1 -- Phone1-1
           -- Addr. 1-2 -- Phone1-2
           -- Addr. 1-3 -- Phone1-3
Cust. 2 -- Addr. 2-1 -- Phone2-1
                             -- Phone2-2

May be using a tree would be better but I want to use the filter row feature to look up for a customer by any property.

Is this possible? Do you recomend another control instead?

Best regards.

Gonzalo



Nick
Telerik team
 answered on 29 Dec 2008
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
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
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
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
Styling
Barcode
BindingNavigator
PopupEditor
RibbonForm
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
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
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?