Dim
test
As
String
test =
String
.Format(
"Row changed, current Name = {0}"
, RadMultiColumnComboBox1.EditorControl.Rows(RadMultiColumnComboBox1.SelectedIndex).Cells(
"ContactName"
).Value)
textbox1.text = test
const
int
CST_AUTO_EXPAND_START = 15;
//Last %
bool
m_alreadyScroll =
false
;
public
Form1()
{
InitializeComponent();
}
private
void
AddDatas()
{
List<
string
> datas =
new
List<
string
>();
for
(
int
i = 0; i < 50; i++)
{
datas.Add(
"string"
+ i.ToString());
}
radGridView1.DataSource = datas;
}
public
void
ExpandPage()
{
m_alreadyScroll =
true
;
radGridView1.BeginUpdate();
//Normally I would update my datasource here threw a background worker
radGridView1.EndUpdate();
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
radGridView1.GridElement.VScrollBar.ValueChanged +=
new
EventHandler(VScrollBar_ValueChanged);
AddDatas();
}
void
VScrollBar_ValueChanged(
object
sender, EventArgs e)
{
if
(m_alreadyScroll)
return
;
Telerik.WinControls.UI.RadScrollBarElement scrollBar = (Telerik.WinControls.UI.RadScrollBarElement)sender;
int
maxValue = scrollBar.Maximum - scrollBar.LargeChange;
//if the scroll bar is in the bottom zone, we search for new data
if
(maxValue - maxValue * CST_AUTO_EXPAND_START / 100 < scrollBar.Value)
ExpandPage();
}
Special characters should be validated in the grid view filter cell & Custom filter dialog from context menu
I tried the following ways and it was successful for Rad grid view filter cell
I tried validating in filter changing event while the user enters in the filter cell
If (grid.IsInEditMode = True) Then
If (grid.ActiveEditor.Value IsNot Nothing) Then
Dim strFilterCellValue As String = grid.ActiveEditor.Value
If (strFilterCellValue.Contains("*") Or strFilterCellValue.Contains("[")) Then
Dim lastIndexOfFilterCell As Integer = strFilterCellValue.Count - 1
Dim strNewFilterCellValue As String = strFilterCellValue.Remove(lastIndexOfFilterCell, 1)
grid.ActiveEditor.Value = strNewFilterCellValue
grid.CurrentCell.Editor.BeginEdit()
Return 1
Exit Function
End If
End If
End If
And for Custom filter menu
If (cellValue IsNot Nothing) Then
Dim totalCount As Integer = cellValue.Count
If (cellValue.Contains("*")) Then
Dim indexOfStar As String = cellValue.IndexOf("*")
Dim numOfCharsRemoved As String = totalCount - indexOfStar
Dim strNewFilterCellValue As String = cellValue.Remove(indexOfStar, numOfCharsRemoved)
grid.CurrentCell.Value = strNewFilterCellValue
grid.MasterGridViewTemplate.FilterExpressions.EndItemUpdate()
Return 2
Exit Function
End If
If (cellValue.Contains("[")) Then
Dim indexOfOpenBracket As String = cellValue.IndexOf("[")
Dim numOfCharsRemoved As String = totalCount - indexOfOpenBracket
Dim strNewFilterCellValue As String = cellValue.Remove(indexOfOpenBracket, numOfCharsRemoved)
grid.CurrentCell.Value = strNewFilterCellValue
grid.MasterGridViewTemplate.FilterExpressions.EndItemUpdate()
Return 2
Exit Function
End If
The issue is I m unable to validate both together that is for custom filter option & while the user enters in the filter cell
Thanks,
Julian