public
partial
class
ManualBuildTest : Form
{
public
ManualBuildTest()
{
InitializeComponent();
}
private
void
ManualBuildTest_Load(
object
sender, EventArgs e)
{
var col1 =
new
DataLinkColumn(
string
.Empty);
col1.AllowGroup =
true
;
col1.HeaderText =
"Requested By"
;
Grid.Columns.Add(col1);
var col =
new
GridViewTextBoxColumn();
col.AllowGroup =
true
;
col.ReadOnly =
false
;
col.HeaderText =
"Position"
;
Grid.Columns.Add(col);
col =
new
GridViewTextBoxColumn();
col.AllowGroup =
true
;
col.ReadOnly =
false
;
col.HeaderText =
"Organisation"
;
Grid.Columns.Add(col);
col =
new
GridViewTextBoxColumn();
col.AllowGroup =
false
;
col.ReadOnly =
false
;
col.HeaderText =
"Work Phone"
;
Grid.Columns.Add(col);
col =
new
GridViewTextBoxColumn();
col.AllowGroup =
false
;
col.ReadOnly =
false
;
col.HeaderText =
"Mobile"
;
Grid.Columns.Add(col);
col =
new
GridViewTextBoxColumn();
col.AllowGroup =
false
;
col.ReadOnly =
false
;
col.HeaderText =
"E-Mail"
;
Grid.Columns.Add(col);
col =
new
GridViewTextBoxColumn();
col.AllowGroup =
false
;
col.ReadOnly =
false
;
col.HeaderText =
"Fax"
;
Grid.Columns.Add(col);
var dcol =
new
GridViewDateTimeColumn();
dcol.AllowGroup =
true
;
dcol.ReadOnly =
false
;
dcol.HeaderText =
"Date Requested"
;
Grid.Columns.Add(dcol);
col =
new
GridViewTextBoxColumn();
col.AllowGroup =
true
;
col.ReadOnly =
false
;
col.HeaderText =
"Request"
;
Grid.Columns.Add(col);
col =
new
GridViewTextBoxColumn();
col.AllowGroup =
true
;
col.ReadOnly =
false
;
col.HeaderText =
"Status"
;
Grid.Columns.Add(col);
col =
new
GridViewTextBoxColumn();
col.AllowGroup =
true
;
col.ReadOnly =
false
;
col.HeaderText =
"Assigned To"
;
Grid.Columns.Add(col);
dcol =
new
GridViewDateTimeColumn();
dcol.AllowGroup =
true
;
dcol.ReadOnly =
false
;
dcol.HeaderText =
"Request Completed"
;
Grid.Columns.Add(dcol);
col =
new
GridViewTextBoxColumn();
col.AllowGroup =
true
;
col.ReadOnly =
false
;
col.HeaderText =
"Result of Request"
;
Grid.Columns.Add(col);
Grid.Rows.AddNew();
Grid.Rows.AddNew();
}
}
public
class
DataLinkColumn : GridViewDataColumn
{
public
DataLinkColumn(
string
fieldName)
:
base
(fieldName)
{
}
public
override
Type GetCellType(GridViewRowInfo row)
{
if
(row
is
GridViewDataRowInfo)
return
typeof
(DataLinkCellElement);
return
base
.GetCellType(row);
}
}
public
class
DataLinkCellElement : GridDataCellElement
{
private
RadButtonElement _ctlButton;
public
DataLinkCellElement(GridViewColumn column, GridRowElement row)
:
base
(column, row)
{
}
protected
override
void
CreateChildElements()
{
base
.CreateChildElements();
_ctlButton =
new
RadButtonElement();
_ctlButton.Text =
"TEST"
;
_ctlButton.ShowBorder =
true
;
Children.Add(_ctlButton);
}
protected
override
void
SetContentCore(
object
value)
{
_ctlButton.Text = value ==
null
?
"(null)"
: value.ToString();
}
}
If you then run the form, everything (usually) looks fine at first: the custom column appears in the first column as set (the cell contains a button with the word "(null)" in it for now).
But if you make sure that the window is small enough that the Grid's horizontal scrollbar appears, and scroll back and forth, the custom button is appearing in other cells sporadically (see the attachment for an example).
I've tried to match my code to existing code examples, and even tried it with the RadRadioButtonCellElement custom column from the Knowledge Base, and got the same result.
Is there something fundamentally wrong with my code?
FRASER TUSTIAN
Hi
In 2010 Q2 SP2 in row for adding new rows there was text: Click here to add new row (or very similar). This text is missing in Q3 by default. How can I display this text in Q3 (in row for adding new rows)?
Reagrds