Hi,
The combination of GridCellSelectionMode MultiColumn and UseStaticHeaders does not work, nothing happens onclick.
Without UseStaticHeaders theres no problem to multiselect columns.
I have generic grid columns, all added programmatically.
Any solutions?
Best Regards
The combination of GridCellSelectionMode MultiColumn and UseStaticHeaders does not work, nothing happens onclick.
Without UseStaticHeaders theres no problem to multiselect columns.
I have generic grid columns, all added programmatically.
Any solutions?
Best Regards
7 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 14 Mar 2014, 06:49 AM
Hi Ronny,
It is hard to identify the issue with such less information, please provide your full code snippet. Below is a sample code snippet which works fine with use of UseStaticHeaders and MultiColumn cell selection. Please have a try and see if it helps.
ASPX:
C#:
JS:
Thanks,
Princy
It is hard to identify the issue with such less information, please provide your full code snippet. Below is a sample code snippet which works fine with use of UseStaticHeaders and MultiColumn cell selection. Please have a try and see if it helps.
ASPX:
<
asp:PlaceHolder
ID
=
"PlaceHolder1"
runat
=
"server"
></
asp:PlaceHolder
>
C#:
RadGrid RadGrid1;
protected
void
Page_Init(
object
source, System.EventArgs e)
{
RadGrid1 =
new
RadGrid();
RadGrid1.MasterTableView.DataKeyNames =
new
string
[] {
"OrderID"
};
RadGrid1.Skin =
"Default"
;
RadGrid1.Width = Unit.Percentage(100);
RadGrid1.Height= Unit.Pixel(800);
RadGrid1.AutoGenerateColumns =
false
;
RadGrid1.AllowSorting =
true
;
RadGrid1.ClientSettings.Scrolling.AllowScroll =
true
;
RadGrid1.ClientSettings.Scrolling.UseStaticHeaders =
true
;
RadGrid1.ClientSettings.Selecting.CellSelectionMode = GridCellSelectionMode.MultiColumn;
RadGrid1.ClientSettings.ClientEvents.OnCellSelected =
"OnCellSelected"
;
RadGrid1.NeedDataSource +=
new
GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
GridBoundColumn boundColumn;
boundColumn =
new
GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"OrderID"
;
boundColumn.HeaderText =
"OrderID"
;
boundColumn.SortExpression =
"OrderID"
;
boundColumn =
new
GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"ShipCountry"
;
boundColumn.HeaderText =
"ShipCountry"
;
boundColumn.SortExpression =
"ShipCountry"
;
boundColumn =
new
GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"CustomerID"
;
boundColumn.HeaderText =
"CustomerID"
;
boundColumn.SortExpression =
"CustomerID"
;
this
.PlaceHolder1.Controls.Add(RadGrid1);
}
void
RadGrid1_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource = GetDataTable(
"SELECT * FROM Orders"
);
}
public
DataTable GetDataTable(
string
query)
{
String ConnString = ConfigurationManager.ConnectionStrings[
"Northwind_newConnectionString3"
].ConnectionString;
SqlConnection conn =
new
SqlConnection(ConnString);
SqlDataAdapter adapter =
new
SqlDataAdapter();
adapter.SelectCommand =
new
SqlCommand(query, conn);
DataTable myDataTable =
new
DataTable();
conn.Open();
try
{
adapter.Fill(myDataTable);
}
finally
{
conn.Close();
}
return
myDataTable;
}
JS:
<script type=
"text/javascript"
>
function
OnCellSelected(sender, eventArgs) {
var
Rows = eventArgs.get_gridDataItem();
var
rowIndex = Rows.get_itemIndexHierarchical();
//Get index
var
columnName = eventArgs.get_column().get_uniqueName();
var
data = Rows.get_cell(columnName);
alert(data.innerHTML);
//Get the cell value
}
</script>
Thanks,
Princy
0

Ronny
Top achievements
Rank 1
answered on 14 Mar 2014, 12:40 PM
Thanks for your reply, my Code is nearly similar.
The grid is hosted in as a SharePoint 2013 webpart.
Without UseStaticHeaders i can select all columns, with UseStaticHeaders only the cell click works.
Please see attached screenshots.
Thanks
private
void
InitRadGrid()
{
SetAdditionalFeatureList();
_radGrid =
new
RadGrid();
_radGrid.ID =
"_radGrid"
;
_radGrid.Font.Size =
this
.Prop_FontSize;
_radGrid.Skin =
this
.prop_RadGrid_Skin_Enum.ToString();
_radGrid.ExportSettings.Pdf.AllowPrinting =
true
;
_radGrid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
_radGrid.MasterTableView.CommandItemStyle.Wrap =
true
;
_radGrid.MasterTableView.CommandItemTemplate =
new
CCCommandItemTemplate(
this
.Prop_RadGrid_Skin.ToString(),
this
.Prop_FontSize,
this
.Prop_ShowUpdateButton,
this
.Prop_UpdateButtonCaption,
this
.Prop_ShowFinishButton,
this
.Prop_FinishButtonCaption,
this
.Prop_ShowUndoFinishButton,
this
.Prop_UndoFinishButtonCaption,
this
.Prop_ShowReviewButton,
this
.Prop_ReviewButtonCaption,
this
.Prop_ShowPDFExportButton,
this
.Prop_PdfExportButtonCaption);
_radGrid.ItemCreated += _radGrid_ItemCreated;
_radGrid.NeedDataSource += _radGrid_NeedDataSource;
_radGrid.AllowMultiRowEdit =
true
;
_radGrid.ItemDataBound += _radgrid_ItemDataBound;
_radGrid.ItemCommand += _radGrid_ItemCommand;
_radGrid.Init += _radGrid_Init;
_radGrid.ClientSettings.Selecting.CellSelectionMode = GridCellSelectionMode.MultiColumn;
_radGrid.ClientSettings.EnableAlternatingItems =
true
;
if
(
this
.Prop_Allow_Columns_Resize)
{
_radGrid.ClientSettings.Resizing.AllowColumnResize =
true
;
_radGrid.ClientSettings.Resizing.AllowResizeToFit =
true
;
_radGrid.ClientSettings.Resizing.ResizeGridOnColumnResize =
true
;
_radGrid.ClientSettings.Resizing.EnableRealTimeResize =
true
;
_radGrid.ClientSettings.Resizing.ShowRowIndicatorColumn =
true
;
}
_radGrid.ClientSettings.Selecting.EnableDragToSelectRows =
true
;
_radGrid.MasterTableView.EditMode =
this
.Prop_RadGrid_EditMode;
_radGrid.AutoGenerateColumns =
false
;
_radGrid.ShowFooter =
true
;
_radGrid.MasterTableView.TableLayout = GridTableLayout.Auto;
if
(Prop_EnableFiltering)
{
_radGrid.AllowFilteringByColumn =
true
;
_radGrid.EnableLinqExpressions =
false
;
}
if
(Prop_EnableSorting)
{
_radGrid.AllowSorting =
true
;
}
if
(Prop_FreezeInfoColumns)
{
_radGrid.ClientSettings.Scrolling.AllowScroll =
true
;
_radGrid.ClientSettings.Scrolling.FrozenColumnsCount =
this
.Prop_FreezeInfoColumns_Count;
_radGrid.ClientSettings.Scrolling.SaveScrollPosition =
true
;
_radGrid.ClientSettings.Scrolling.UseStaticHeaders =
true
;
_radGrid.ClientSettings.Selecting.CellSelectionMode = GridCellSelectionMode.MultiColumn;
}
}
The grid is hosted in as a SharePoint 2013 webpart.
Without UseStaticHeaders i can select all columns, with UseStaticHeaders only the cell click works.
Please see attached screenshots.
Thanks
0

Ronny
Top achievements
Rank 1
answered on 14 Mar 2014, 12:42 PM
Error on Screenshot Upload last post.
0

Ronny
Top achievements
Rank 1
answered on 20 Mar 2014, 04:45 PM
Sorry for *Bump*, but this is very important for my customer.
Greetings
Greetings
0
Hi Ronny,
From the provided code I did not notice how are the columns being added. However I noticed that both multi-column headers and frozen column are enabled. Note that this is currently not supported(as noted here) and may cause unexpected behavior. Therefore I recommend enabling only the multi-column headers functionality and testing whether the problem is resolved. Additionally please ensure that a JavaScript error is not present on the page which might be breaking the functionality.
Regards,
Angel Petrov
Telerik
From the provided code I did not notice how are the columns being added. However I noticed that both multi-column headers and frozen column are enabled. Note that this is currently not supported(as noted here) and may cause unexpected behavior. Therefore I recommend enabling only the multi-column headers functionality and testing whether the problem is resolved. Additionally please ensure that a JavaScript error is not present on the page which might be breaking the functionality.
Regards,
Angel Petrov
Telerik
Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.
0

Ronny
Top achievements
Rank 1
answered on 26 Mar 2014, 08:14 AM
Hi Angel,
I tested with complete disabled multheaders, still have the same problem.
See following code how my columns are added:
The cells are set to editable:
On _radGrid_ItemCreated i implemented cell validations and rules for visibility.
I also tried several combinations of radgrid properties, nothing worked :-(
Best regards
I tested with complete disabled multheaders, still have the same problem.
See following code how my columns are added:
protected
void
SetGridColumns(DataTable dataTable)
{
if
(_radGrid.Columns.Count > 0)
return
;
string
[] monthnames = culture.DateTimeFormat.MonthNames;
List<DateTime> dtList =
new
List<DateTime>();
DateTime currDT =
this
.currentPeriodStart;
while
(currDT <=
this
.currentPeriodEnd)
{
dtList.Add(currDT);
currDT = currDT.AddDays(1);
}
if
(!
this
.Prop_FreezeInfoColumns)
{
List<
string
> monthInDaterangeList =
new
List<
string
>();
List<
int
> kWInDaterangeList =
new
List<
int
>();
foreach
(DateTime dt
in
dtList)
{
// KalenderWoche
CultureInfo CUI = CultureInfo.CurrentCulture;
int
kw = CUI.Calendar.GetWeekOfYear(dt, CUI.DateTimeFormat.CalendarWeekRule, CUI.DateTimeFormat.FirstDayOfWeek);
if
(Prop_ShowMonth && !monthInDaterangeList.Contains(String.Format(
"{0:MMMM}"
, dt).ToString()))
{
monthInDaterangeList.Add(String.Format(
"{0:MMMM}"
, dt).ToString());
GridColumnGroup monthGrp =
new
GridColumnGroup();
//monthGrp.HeaderText = String.Format("{0:MMMM}", dt).ToString() + Environment.NewLine + dt.Year.ToString();
monthGrp.HeaderText = monthnames[(
int
)dt.Month - 1] + Environment.NewLine + dt.Year.ToString();
monthGrp.Name =
"Year"
+ dt.Year.ToString() + String.Format(
"{0:MMMM}"
, dt).ToString();
monthGrp.HeaderStyle.Font.Bold =
true
;
monthGrp.HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
monthGrp.HeaderStyle.Font.Size =
this
.Prop_FontSize;
this
._radGrid.MasterTableView.ColumnGroups.Add(monthGrp);
}
if
(Prop_ShowKW && !kWInDaterangeList.Contains(kw))
{
kWInDaterangeList.Add(kw);
GridColumnGroup kWGrp =
new
GridColumnGroup();
string
kw_string =
"KW"
;
switch
(
this
.Prop_Language)
{
case
"en-US"
:
{
kw_string =
"Calendar Week"
;
break
;
}
case
"de-DE"
:
{
kw_string =
"Kalenderwoche"
;
break
;
}
default
:
{
kw_string =
"Calendar Week"
;
break
;
}
}
kWGrp.HeaderText = kw_string +
" "
+ kw.ToString();
kWGrp.Name =
"Year"
+ dt.Year.ToString() +
"KW"
+ kw.ToString();
kWGrp.HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
kWGrp.HeaderStyle.Font.Size =
this
.Prop_FontSize;
if
(Prop_ShowMonth)
kWGrp.ParentGroupName =
"Year"
+ dt.Year.ToString() + String.Format(
"{0:MMMM}"
, dt).ToString();
this
._radGrid.MasterTableView.ColumnGroups.Add(kWGrp);
}
}
GridColumnGroup colGrp1 =
new
GridColumnGroup();
if
(!
string
.IsNullOrEmpty(
this
.Prop_ProjectGrpCaption))
colGrp1.HeaderText = Prop_ProjectGrpCaption;
colGrp1.Name =
"ProjectGroup"
;
colGrp1.HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
colGrp1.HeaderStyle.Font.Bold =
true
;
colGrp1.HeaderStyle.Font.Size =
this
.Prop_FontSize;
this
._radGrid.MasterTableView.ColumnGroups.Add(colGrp1);
}
// Gruppe Projekte
GridBoundColumn gbc =
new
GridBoundColumn();
if
(!
this
.Prop_FreezeInfoColumns)
gbc.ColumnGroupName =
"ProjectGroup"
;
if
(!
string
.IsNullOrEmpty(
this
.Prop_AdditionalCaption1))
gbc.HeaderText =
this
.Prop_AdditionalCaption1;
gbc.HeaderStyle.Font.Size =
this
.Prop_FontSize;
gbc.ItemStyle.Font.Size =
this
.Prop_FontSize;
gbc.UniqueName =
"SortOrder"
;
gbc.DataField =
"Sort Order"
;
gbc.DataType =
typeof
(
int
);
gbc.ReadOnly =
false
;
gbc.Visible =
this
.additionalFeatureList.Contains(
"Favorites"
);
if
(Prop_EnableFiltering)
{
gbc.AutoPostBackOnFilter =
true
;
gbc.AllowFiltering =
true
;
}
gbc.AllowSorting =
false
;
gbc.ShowSortIcon =
false
;
this
._radGrid.Columns.Add(gbc);
gbc =
new
GridBoundColumn();
if
(!
this
.Prop_FreezeInfoColumns)
gbc.ColumnGroupName =
"ProjectGroup"
;
if
(!
string
.IsNullOrEmpty(
this
.Prop_JobNoCaption))
gbc.HeaderText =
this
.Prop_JobNoCaption;
gbc.HeaderStyle.Font.Size =
this
.Prop_FontSize;
gbc.ItemStyle.Font.Size =
this
.Prop_FontSize;
gbc.UniqueName =
"JobNo_"
;
gbc.DataField =
"Job No_"
;
gbc.ReadOnly =
true
;
if
(Prop_EnableFiltering)
{
gbc.AutoPostBackOnFilter =
true
;
gbc.AllowFiltering =
true
;
}
gbc.AllowSorting =
true
;
gbc.ShowSortIcon =
true
;
this
._radGrid.Columns.Add(gbc);
gbc =
new
GridBoundColumn();
if
(!
this
.Prop_FreezeInfoColumns)
gbc.ColumnGroupName =
"ProjectGroup"
;
if
(!
string
.IsNullOrEmpty(
this
.Prop_JobDescriptionCaption))
gbc.HeaderText =
this
.Prop_JobDescriptionCaption;
gbc.HeaderStyle.Font.Size =
this
.Prop_FontSize;
gbc.ItemStyle.Font.Size =
this
.Prop_FontSize;
gbc.UniqueName =
"JobDescription"
;
gbc.DataField =
"Job Description"
;
gbc.ReadOnly =
true
;
if
(!
this
.Prop_Wrap_Description)
gbc.DataFormatString =
"<nobr>{0}</nobr>"
;
if
(Prop_EnableFiltering)
{
gbc.AutoPostBackOnFilter =
true
;
gbc.AllowFiltering =
true
;
}
gbc.AllowSorting =
true
;
this
._radGrid.Columns.Add(gbc);
gbc =
new
GridBoundColumn();
if
(!
this
.Prop_FreezeInfoColumns)
gbc.ColumnGroupName =
"ProjectGroup"
;
gbc.HeaderStyle.Font.Size =
this
.Prop_FontSize;
gbc.ItemStyle.Font.Size =
this
.Prop_FontSize;
gbc.UniqueName =
"JobLineUniqueNo_"
;
gbc.DataField =
"Job Line Unique No_"
;
gbc.ReadOnly =
true
;
gbc.Visible =
false
;
this
._radGrid.Columns.Add(gbc);
gbc =
new
GridBoundColumn();
if
(!
this
.Prop_FreezeInfoColumns)
gbc.ColumnGroupName =
"ProjectGroup"
;
if
(!
string
.IsNullOrEmpty(
this
.Prop_JobLineDescriptionCaption))
gbc.HeaderText =
this
.Prop_JobLineDescriptionCaption;
gbc.HeaderStyle.Font.Size =
this
.Prop_FontSize;
gbc.ItemStyle.Font.Size =
this
.Prop_FontSize;
gbc.UniqueName =
"JobLineDescription"
;
gbc.DataField =
"Job Line Description"
;
if
(!
this
.Prop_Wrap_Description)
gbc.DataFormatString =
"<nobr>{0}</nobr>"
;
gbc.ReadOnly =
true
;
if
(Prop_EnableFiltering)
{
gbc.AutoPostBackOnFilter =
true
;
gbc.AllowFiltering =
true
;
}
gbc.AllowSorting =
true
;
this
._radGrid.Columns.Add(gbc);
gbc =
new
GridBoundColumn();
if
(!
this
.Prop_FreezeInfoColumns)
gbc.ColumnGroupName =
"ProjectGroup"
;
if
(!
string
.IsNullOrEmpty(
this
.Prop_TimeValueCaption))
gbc.HeaderText =
this
.Prop_TimeValueCaption;
gbc.HeaderStyle.Font.Size =
this
.Prop_FontSize;
gbc.ItemStyle.Font.Size =
this
.Prop_FontSize;
gbc.UniqueName =
"TimeValue"
;
gbc.DataField =
"TimeValue"
;
gbc.ReadOnly =
true
;
if
(Prop_EnableFiltering)
{
gbc.AutoPostBackOnFilter =
true
;
gbc.AllowFiltering =
true
;
}
gbc.AllowSorting =
false
;
gbc.ItemStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
this
._radGrid.Columns.Add(gbc);
dataTable.Columns.Add(
"TimeValue"
);
int
i = 0;
string
[] daynames = culture.DateTimeFormat.AbbreviatedDayNames;
foreach
(DateTime dt
in
dtList)
{
i++;
// KalenderWoche
CultureInfo CUI = CultureInfo.CurrentCulture;
int
kw = CUI.Calendar.GetWeekOfYear(dt, CUI.DateTimeFormat.CalendarWeekRule, CUI.DateTimeFormat.FirstDayOfWeek);
gbc =
new
GridBoundColumn();
if
(!Prop_FreezeInfoColumns)
{
if
(Prop_ShowMonth && !Prop_ShowKW)
gbc.ColumnGroupName =
"Year"
+ dt.Year.ToString() + String.Format(
"{0:MMMM}"
, dt).ToString();
else
if
(Prop_ShowKW)
gbc.ColumnGroupName =
"Year"
+ dt.Year.ToString() +
"KW"
+ kw.ToString();
}
gbc.HeaderStyle.Font.Size =
this
.Prop_FontSize;
gbc.ItemStyle.Font.Size =
this
.Prop_FontSize;
gbc.DataType =
typeof
(
decimal
);
string
day = daynames[(
int
)dt.DayOfWeek];
gbc.HeaderText = day + Environment.NewLine + dt.ToString(
"dd"
);
gbc.HeaderStyle.Wrap =
false
;
gbc.UniqueName = dt.ToString(
"yyyy/MM/dd"
);
gbc.DataField = dt.ToString(
"yyyy/MM/dd"
);
gbc.MaxLength = 5;
gbc.HeaderTooltip =
"Zur Auswahl klicken"
;
gbc.AllowFiltering =
false
;
gbc.AllowSorting =
false
;
gbc.HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
switch
(dt.DayOfWeek)
{
case
DayOfWeek.Saturday:
case
DayOfWeek.Sunday:
{
if
(!
string
.IsNullOrEmpty(
this
.Prop_WeekendColumnColor))
gbc.HeaderStyle.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(
this
.Prop_WeekendColumnColor, 16));
break
;
}
default
:
{
break
;
}
}
if
(!PZEDateHasCapacity(dt))
{
if
(!
string
.IsNullOrEmpty(
this
.Prop_WithoutCapacityColumnColor))
gbc.HeaderStyle.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(
this
.Prop_WithoutCapacityColumnColor, 16));
if
(!
string
.IsNullOrEmpty(
this
.Prop_WithoutCapacityColumnColor))
gbc.ItemStyle.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(
this
.Prop_WithoutCapacityColumnColor, 16));
}
this
._radGrid.Columns.Add(gbc);
dataTable.Columns.Add(dt.ToString(
"yyyy/MM/dd"
));
}
}
The cells are set to editable:
protected
void
SetGridEditable()
{
for
(
int
i = 0; i < _radGrid.MasterTableView.Items.Count; i++)
{
_radGrid.EditIndexes.Add(i);
}
_radGrid.Rebind();
}
On _radGrid_ItemCreated i implemented cell validations and rules for visibility.
protected
void
UpdateGridCells(GridItem gridItem)
{
if
(gridItem
is
GridEditableItem && gridItem.IsInEditMode)
{
GridEditableItem item = gridItem
as
GridEditableItem;
int
i = 0;
foreach
(GridBoundColumn col
in
_radGrid.Columns)
{
string
colUniqueName = col.UniqueName;
if
(colUniqueName.Equals(
"SortOrder"
))
{
GridTextBoxColumnEditor editor = (GridTextBoxColumnEditor)item.EditManager.GetColumnEditor(colUniqueName);
TableCell cell = (TableCell)editor.TextBoxControl.Parent;
editor.TextBoxControl.Columns = 1;
}
DateTime colDate = DateTime.MinValue;
DateTime.TryParse(colUniqueName,
out
colDate);
if
(colDate != DateTime.MinValue)
{
GridTextBoxColumnEditor editor = (GridTextBoxColumnEditor)item.EditManager.GetColumnEditor(colUniqueName);
TableCell cell = (TableCell)editor.TextBoxControl.Parent;
int
jobLineUniqueNo = Convert.ToInt32(((DataRowView)item.DataItem).Row.ItemArray[1]);
string
jobNo = ((DataRowView)item.DataItem).Row.ItemArray[0].ToString();
editor.TextBoxControl.Columns = 1;
int
entryType = GetTimeEntryType(jobNo, jobLineUniqueNo, colDate);
if
(entryType.Equals(0))
{
if
(!
string
.IsNullOrEmpty(
this
.Prop_StandardTEColumnColor))
cell.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(
this
.Prop_StandardTEColumnColor, 16));
}
switch
(colDate.DayOfWeek)
{
case
DayOfWeek.Saturday:
case
DayOfWeek.Sunday:
{
if
(!
string
.IsNullOrEmpty(
this
.Prop_WeekendColumnColor))
{
col.ItemStyle.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(
this
.Prop_WeekendColumnColor, 16));
}
break
;
}
default
:
{
break
;
}
}
int
readOnly = 0;
int
cellState = GetTimeEntryCellEditableState(jobNo, jobLineUniqueNo, colDate,
out
readOnly);
switch
(cellState)
{
case
0:
// nicht editierbar - Eintrag nicht vorhanden
{
if
(
string
.IsNullOrEmpty(((DataRowView)item.DataItem).Row.ItemArray[i].ToString()))
{
editor.TextBoxControl.Visible =
false
;
}
else
{
editor.TextBoxControl.Enabled =
false
;
}
break
;
}
case
1:
// ReadOnly - Eintrag nicht mehr editierbar
{
if
(
string
.IsNullOrEmpty(((DataRowView)item.DataItem).Row.ItemArray[i].ToString()))
{
editor.TextBoxControl.Visible =
false
;
}
else
{
decimal
dec = 0;
decimal
.TryParse(((DataRowView)item.DataItem).Row.ItemArray[i].ToString(),
out
dec);
if
(dec == 0)
editor.TextBoxControl.Visible =
false
;
else
editor.TextBoxControl.Enabled =
false
;
}
editor.TextBoxControl.ForeColor = Color.Red;
break
;
}
case
2:
// editierbar
{
if
(
string
.IsNullOrEmpty(((DataRowView)item.DataItem).Row.ItemArray[i].ToString()))
{
editor.TextBoxControl.Visible =
true
;
}
else
{
editor.TextBoxControl.Enabled =
true
;
}
break
;
}
case
3:
// Status zurückgesetzt
{
if
(
string
.IsNullOrEmpty(((DataRowView)item.DataItem).Row.ItemArray[i].ToString()))
{
editor.TextBoxControl.Visible =
true
;
}
else
{
editor.TextBoxControl.Enabled =
true
;
}
editor.TextBoxControl.ForeColor = Color.Red;
break
;
}
case
4:
// Abgeschlossen
{
if
(
string
.IsNullOrEmpty(((DataRowView)item.DataItem).Row.ItemArray[i].ToString()))
{
editor.TextBoxControl.Visible =
false
;
}
else
{
editor.TextBoxControl.Visible =
true
;
}
editor.TextBoxControl.Enabled =
false
;
editor.TextBoxControl.Font.Bold =
true
;
if
(!
string
.IsNullOrEmpty(
this
.Prop_FinishedColumnColor))
{
col.ItemStyle.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(
this
.Prop_FinishedColumnColor, 16));
}
break
;
}
case
5:
// Abgeschlossen u. Importiert
{
if
(
string
.IsNullOrEmpty(((DataRowView)item.DataItem).Row.ItemArray[i].ToString()))
{
editor.TextBoxControl.Visible =
false
;
}
else
{
editor.TextBoxControl.Enabled =
false
;
}
editor.TextBoxControl.Font.Bold =
true
;
if
(!
string
.IsNullOrEmpty(
this
.Prop_FinishedColumnColor))
col.ItemStyle.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(
this
.Prop_FinishedColumnColor, 16));
break
;
}
case
6:
// Reviewed
{
if
(
string
.IsNullOrEmpty(((DataRowView)item.DataItem).Row.ItemArray[i].ToString()))
{
editor.TextBoxControl.Visible =
false
;
}
else
{
editor.TextBoxControl.Enabled =
false
;
}
editor.TextBoxControl.Font.Bold =
true
;
editor.TextBoxControl.ForeColor = Color.Green;
if
(!
string
.IsNullOrEmpty(
this
.Prop_ReviewedColumnColor))
col.ItemStyle.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(
this
.Prop_ReviewedColumnColor, 16));
break
;
}
}
switch
(entryType)
{
case
0:
// Standard
{
// not implemented
break
;
}
case
1:
// S+P
{
int
suPType = GetSuPEntryType(jobNo, jobLineUniqueNo, colDate);
string
fzColor = sqlFunctions.GetPZEFZArtColor_sp(suPType);
if
(!
string
.IsNullOrEmpty(fzColor))
cell.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(fzColor, 16));
if
(
string
.IsNullOrEmpty(((DataRowView)item.DataItem).Row.ItemArray[i].ToString()))
{
editor.TextBoxControl.Visible =
false
;
}
else
{
editor.TextBoxControl.Enabled =
false
;
}
break
;
}
}
if
(!LoginUserCanUpdateResource())
{
editor.TextBoxControl.Enabled =
false
;
}
if
(readOnly == 1)
{
if
(
string
.IsNullOrEmpty(((DataRowView)item.DataItem).Row.ItemArray[i].ToString()))
{
editor.TextBoxControl.Visible =
false
;
}
else
{
decimal
nullDec = 0;
decimal
.TryParse(((DataRowView)item.DataItem).Row.ItemArray[i].ToString(),
out
nullDec);
if
(nullDec != 0)
editor.TextBoxControl.Enabled =
false
;
else
editor.TextBoxControl.Visible =
false
;
}
}
PZECustomValidator columnValidator =
new
PZECustomValidator();
columnValidator.JobNo = jobNo;
columnValidator.JobLineUniqueNo = jobLineUniqueNo;
columnValidator.ColumnDate = colDate;
columnValidator.ServerValidate += columnValidator_ServerValidate;
columnValidator.ControlToValidate = editor.TextBoxControl.ID;
columnValidator.Display = ValidatorDisplay.Dynamic;
columnValidator.ForeColor = Color.Red;
columnValidator.SetFocusOnError =
true
;
columnValidator.ErrorMessage =
"Fehler"
;
cell.Controls.Add(columnValidator);
}
i++;
}
}
if
(editableRebind)
{
if
(gridItem
is
GridDataItem)
{
GridDataItem item = (GridDataItem)gridItem;
ist_sum_filtered +=
decimal
.Parse(((DataRowView)item.DataItem).Row.ItemArray[4].ToString());
int
i = 0;
foreach
(GridColumn col
in
_radGrid.Columns)
{
string
colUniqueName = col.UniqueName;
DateTime colDate = DateTime.MinValue;
DateTime.TryParse(colUniqueName,
out
colDate);
if
(colDate != DateTime.MinValue)
{
int
jobLineUniqueNo = Convert.ToInt32(((DataRowView)item.DataItem).Row.ItemArray[1]);
string
jobNo = ((DataRowView)item.DataItem).Row.ItemArray[0].ToString();
col_sum[i] += GetPZETimeEntryHours(jobNo, jobLineUniqueNo, colDate, colDate);
}
i++;
}
}
}
if
(gridItem
is
GridFooterItem)
{
GridFooterItem footer = (GridFooterItem)gridItem;
decimal
ist_sum_gesamt =
this
.GetPZETimeEntryHours(
this
.currentPeriodStart,
this
.currentPeriodEnd);
footer[
"JobDescription"
].Text =
string
.Format(
"Soll: {0}"
,
decimal
.Round(
this
.currentCapacityHours,
this
.Prop_MaxDecimalPlaces).ToString());
// Soll
footer[
"JobLineDescription"
].Text =
string
.Format(
"Rest: {0}"
,
decimal
.Round((
this
.currentCapacityHours - ist_sum_gesamt),
this
.Prop_MaxDecimalPlaces).ToString());
// Rest
footer[
"TimeValue"
].Text =
decimal
.Round(ist_sum_gesamt,
this
.Prop_MaxDecimalPlaces).ToString();
// Ist
footer[
"JobLineDescription"
].HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
footer[
"TimeValue"
].HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
int
i = 0;
foreach
(GridColumn col
in
_radGrid.Columns)
{
string
colUniqueName = col.UniqueName;
footer[colUniqueName].Font.Size =
this
.Prop_FontSize;
DateTime colDate = DateTime.MinValue;
DateTime.TryParse(colUniqueName,
out
colDate);
if
(colDate != DateTime.MinValue)
{
footer[colUniqueName].HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
decimal
col_sum_gesamt =
this
.GetPZETimeEntryHours(colDate, colDate);
if
(col_sum_gesamt != 0)
{
if
(!
string
.IsNullOrEmpty(_radGrid.MasterTableView.FilterExpression))
footer[colUniqueName].Text =
string
.Format(
"{0} ({1})"
,
decimal
.Round(col_sum[i],
this
.Prop_MaxDecimalPlaces).ToString(),
decimal
.Round(col_sum_gesamt,
this
.Prop_MaxDecimalPlaces));
else
footer[colUniqueName].Text =
string
.Format(
"{0}"
,
decimal
.Round(col_sum[i],
this
.Prop_MaxDecimalPlaces).ToString());
}
}
i++;
}
}
if
(gridItem
is
GridFilteringItem)
{
GridFilteringItem filteringItem = gridItem
as
GridFilteringItem;
//set dimensions for the filter textbox
if
(
this
.Prop_FilteringColumnSize > 0)
{
TextBox box =
new
TextBox();
if
(
this
.additionalFeatureList.Contains(
"Favorites"
))
{
box = filteringItem[
"SortOrder"
].Controls[0]
as
TextBox;
box.Columns =
this
.Prop_FilteringColumnSize;
box.Font.Size =
this
.Prop_FontSize;
}
box = filteringItem[
"JobNo_"
].Controls[0]
as
TextBox;
box.Columns =
this
.Prop_FilteringColumnSize;
box.Font.Size =
this
.Prop_FontSize;
box = filteringItem[
"JobDescription"
].Controls[0]
as
TextBox;
box.Columns =
this
.Prop_FilteringColumnSize;
box.Font.Size =
this
.Prop_FontSize;
box = filteringItem[
"JobLineDescription"
].Controls[0]
as
TextBox;
box.Columns =
this
.Prop_FilteringColumnSize;
box.Font.Size =
this
.Prop_FontSize;
box = filteringItem[
"TimeValue"
].Controls[0]
as
TextBox;
box.Columns =
this
.Prop_FilteringColumnSize;
box.Font.Size =
this
.Prop_FontSize;
}
}
}
I also tried several combinations of radgrid properties, nothing worked :-(
Best regards
0
Hi Ronny,
I am sorry to say but the information provided is not sufficient for us to determine what might be causing this problem. In order to further investigate the matter I would like to ask you to send us an isolated sample which we can debug locally. Once we have a runnable project that we can inspect we should be able to quickly resolve the problem.
Additionally could you please tell us was there a JavaScript error on the page? Also is the project using the latest version of the controls? If not I suggest updating and testing the application again.
Regards,
Angel Petrov
Telerik
I am sorry to say but the information provided is not sufficient for us to determine what might be causing this problem. In order to further investigate the matter I would like to ask you to send us an isolated sample which we can debug locally. Once we have a runnable project that we can inspect we should be able to quickly resolve the problem.
Additionally could you please tell us was there a JavaScript error on the page? Also is the project using the latest version of the controls? If not I suggest updating and testing the application again.
Regards,
Angel Petrov
Telerik
Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.