Hi,
1. I am trying to set back ground color for child item of panel bar but its not setting.
2. How can i remove hover style for panel bar. I don't want hover style on Panel bar.
3. I want to see multiple items but once i click on different panel bar it collapse. so how can i see multiple items. I wrote following code still its not working.
ExpandMode = PanelBarExpandMode.MultipleExpandedItems
Ascs code
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<telerik:RadCodeBlock ID="rcbCycleChangeHistoryCodeBlock" runat="server">
<style type="text/css">
.RadPanelBar_Windows7 .rpOut
{
background-color: #AC0000;
font-weight: bold;
font-family: Verdana,Helvetica,Calibri;
font-size: 10px;
color: #FFFFFF;
background-color: #AC0000;
}
</style>
</telerik:RadCodeBlock>
<telerik:RadAjaxPanel ID="rapCycleHistory" runat="server">
</telerik:RadAjaxPanel>
In code behind in page load
RadPanelBar cycleChangeHistory = new RadPanelBar()
{
AllowCollapseAllItems = true,
ID = "rpbCycleHistoriesItem",
RegisterWithScriptManager = true,
SkinID = "Windows7",
ViewStateMode = ViewStateMode.Inherit,
Width = Unit.Percentage(98),
CookieName = string.Format("CycleChangeHistory_{0}", base.JcnData.JcnListId),
PersistStateInCookie = true,
ExpandMode = PanelBarExpandMode.MultipleExpandedItems
};
cycleChangeHistory.ItemClick += new RadPanelBarEventHandler(rpbCycleItems_ItemClick);
rapCycleHistory.Controls.Add(cycleChangeHistory);
var changeSets = CycleChangesets.OrderByDescending(jcs => jcs.CycleChangeset);
if (0 == cycleChangeHistory.Items.Count)
{
short changeSetCount = 0;
IList<string> cycles = changeSets.Select(cs => cs.CycleNumber).ToList();
foreach (string cycle in cycles.Distinct())
{
RadPanelItem changeSetBlock = new RadPanelItem()
{
Text = string.Format("Cycle {0} ({1})", cycle, cycles.Where(c => c == cycle).Count()),
Expanded = false,
ClientIDMode = ClientIDMode.Inherit,
TabIndex = changeSetCount,
Value = string.Format("Cycle:{0}", cycle),
PostBack = true,
ChildGroupCssClass = "rpOut",
};
cycleChangeHistory.Items.Add(changeSetBlock);
changeSetCount += 1;
}
}
item click event.
protected void rpbCycleItems_ItemClick(object sender, RadPanelBarEventArgs e)
{
RadPanelItem headerItem = e.Item;
if (0 == headerItem.Controls.Count)
{
if (0 < headerItem.Value.IndexOf("|"))
{
string[] valuePieces = headerItem.Value.Split('|');
string cycleNumber = valuePieces[0].Substring((valuePieces[0].IndexOf(":") + 1));
string cycle = valuePieces[0].Substring((valuePieces[0].IndexOf(":") + 1)).Trim().Substring(valuePieces[0].Substring((valuePieces[0].IndexOf(":") + 1)).Trim().Length - 3);
int changesetId = int.Parse(valuePieces[1].Substring((valuePieces[1].IndexOf(":") + 1)));
if (Session["CycleParameters"] != null)
cycleParameters = Session["CycleParameters"] as List<CycleParameter>;
CycleParameter cp = cycleParameters.Where(p => p.cycleNumber == cycle && p.cycleChangeset == changesetId).FirstOrDefault();
GetCycleChangeHistoryData(cp.jcnListId, cp.jcnChangeset, cp.cycleId, cp.cycleChangeset, cp.cycleNumber, cp.cycleChangesetCount);
CycleChangeHistoryInformation changeSet = CycleChangesets.Where(ccs => ccs.CycleNumber.Trim() == cycle.Trim() && ccs.CycleChangeset == changesetId).FirstOrDefault();
if (changeSet.Items == null)
changeSet.Items = new List<CycleChangesetDifferenceItem>();
if (changeSet.Comments == null)
changeSet.Comments = new List<CycleChangesetCommentItem>();
IList<string> sectionHeaders = changeSet.Items.OrderBy(o => o.orderByCycleSectionName).Select(rcd => rcd.SectionName).Distinct().ToList();
Table historyInformation = new Table()
{
CellPadding = 0,
CellSpacing = 5
};
int rowCount = 0;
foreach (string section in sectionHeaders)
{
var itemfound = changeSet.Items.Where(di => di.SectionName.Equals(section)).Count();
if (itemfound == 0)
continue;
if (itemfound == 1 && string.IsNullOrEmpty(changeSet.Items.Where(di => di.SectionName.Equals(section)).FirstOrDefault().FieldName) == true)
continue;
TableHeaderRow newHeaderRow = new TableHeaderRow();
historyInformation.Rows.Add(newHeaderRow);
TableHeaderCell newHeaderCell = new TableHeaderCell()
{
ColumnSpan = 2,
Text = section
};
newHeaderRow.Cells.Add(newHeaderCell);
Table dataAreaTable = new Table()
{
BackColor = Color.FromArgb(255, 255, 255),
BorderStyle = BorderStyle.Solid,
BorderWidth = Unit.Pixel(1),
CellPadding = 5,
CellSpacing = 0
};
dataAreaTable.Style.Add("table-layout", "fixed");
TableRow dataAreaRow = new TableRow();
dataAreaRow.Cells.Add(new TableCell() { Width = Unit.Pixel(10) });
historyInformation.Rows.Add(dataAreaRow);
TableCell dataAreaCell = new TableCell();
dataAreaCell.Controls.Add(dataAreaTable);
dataAreaRow.Cells.Add(dataAreaCell);
rowCount = 0;
foreach (CycleChangesetDifferenceItem item in changeSet.Items.Where(di => di.SectionName.Equals(section)))
{
rowCount += 1;
if (1 == rowCount)
{
TableHeaderRow headerLabels = new TableHeaderRow();
dataAreaTable.Rows.Add(headerLabels);
string nextChangeset = (changeSet.CycleChangeset + 1).ToString();
if (cp.cycleChangesetCount == changeSet.CycleChangeset)
{
nextChangeset = "Current";
}
headerLabels.Cells.Add(new TableHeaderCell() { CssClass = "changeHistoryHeaderText", HorizontalAlign = HorizontalAlign.Center, Width = Unit.Pixel(175), Text = "Field" });
headerLabels.Cells.Add(new TableHeaderCell() { CssClass = "changeHistoryHeaderText", HorizontalAlign = HorizontalAlign.Center, Width = Unit.Pixel(212), Text = "Changeset " + changesetId });
headerLabels.Cells.Add(new TableHeaderCell() { CssClass = "changeHistoryHeaderText", HorizontalAlign = HorizontalAlign.Center, Width = Unit.Pixel(212), Text = "Changeset " + nextChangeset });
int headerCellCount = 0;
foreach (TableHeaderCell cell in headerLabels.Cells)
{
if (1 < (headerCellCount += 1))
cell.Style.Add("border-left", "1px #000000 solid");
}
}
if (item.FieldName != "Cycle Changeset Comments")
{
TableRow newRow = new TableRow();
dataAreaTable.Rows.Add(newRow);
newRow.Cells.Add(new TableCell() { CssClass = "applicationText", HorizontalAlign = HorizontalAlign.Left, Width = Unit.Pixel(175), Text = item.FieldName });
newRow.Cells.Add(new TableCell() { CssClass = "applicationText", HorizontalAlign = HorizontalAlign.Left, Width = Unit.Pixel(212), Text = item.ChangesetValue });
newRow.Cells.Add(new TableCell() { CssClass = "applicationText", HorizontalAlign = HorizontalAlign.Left, Width = Unit.Pixel(212), Text = item.CurrentValue });
int cellCount = 0;
foreach (TableCell cell in newRow.Cells)
{
if (1 < (cellCount += 1))
cell.Style.Add("border-left", "1px #000000 solid");
cell.Style.Add("border-top", "1px #000000 solid");
}
}
}
}
TableRow spacerRow = new TableRow();
spacerRow.Cells.Add(new TableCell() { ColumnSpan = 2, Text = " ", Height = Unit.Pixel(15) });
historyInformation.Rows.Add(spacerRow);
TableHeaderRow commentHeaderRow = new TableHeaderRow();
commentHeaderRow.Cells.Add(new TableHeaderCell() { ColumnSpan = 2, Text = "Comments" });
historyInformation.Rows.Add(commentHeaderRow);
foreach (CycleChangesetCommentItem comment in changeSet.Comments)
{
TableRow newRow = new TableRow();
newRow.Cells.Add(new TableCell() { Width = Unit.Pixel(10) });
newRow.Cells.Add(new TableCell() { Text = comment.Comment });
historyInformation.Rows.Add(newRow);
}
headerItem.Controls.Add(historyInformation);
}
else
{
string cycleNumber = headerItem.Value.Substring((headerItem.Value.IndexOf(":") + 1));
var changeSets = CycleChangesets.Where(ccs => ccs.CycleNumber == cycleNumber).OrderByDescending(ccs => ccs.CycleChangeset);
short changeSetCount = 0;
foreach (CycleChangeHistoryInformation changeSet in changeSets)
{
string nextChangeset = (changeSet.CycleChangeset + 1).ToString();
string creatorId = string.Empty;
string userDate = string.Empty;
if (null != changeSet.UpdateDate && changeSet.UpdateDate != DateTime.MinValue)
userDate = string.Format("- Date: {0}", changeSet.UpdateDate.ToShortDateString());
if (changeSets.Count() == changeSet.CycleChangeset)
{
nextChangeset = "Current";
int ccs = changeSet.CycleChangeset + 1;
creatorId = (from mu in MembershipDataProvider.LoadMembershipUsers(false)
where mu.UserId == base.JcnData.Cycles.Where(cn => cn.CycleId == changeSet.CycleId && cn.CycleChangeSet == ccs).FirstOrDefault().CycleChangeSetCreatorId
//where mu.UserId == base.CurrentUser //base.JcnData.Cycles.Where(cn => cn.CycleId == changeSet.CycleId && cn.CycleChangeSet == changeSet.CycleChangeset).FirstOrDefault().CycleChangeSetCreatorId
select string.Format("{0} {1}", mu.FirstName, mu.LastName)).FirstOrDefault();
}
else
creatorId = changeSet.CycleChangeSetCreatorId;
RadPanelItem changeSetBlock = new RadPanelItem()
{
Text = string.Format("Changeset: {0} - {1}, User: {2} {3}", changeSet.CycleChangeset, nextChangeset, creatorId, userDate),
Expanded = false,
ClientIDMode = ClientIDMode.Inherit,
TabIndex = changeSetCount,
Value = string.Format("CycleNumber:{0}|CycleChangeSet:{1}", cycleNumber, changeSet.CycleChangeset),
PostBack = true,
ClickedCssClass = "rpOut"
};
changeSetBlock.HoveredImageUrl = null;
changeSetBlock.BackColor = Color.FromArgb(173, 0, 0);
headerItem.Items.Add(changeSetBlock);
changeSetCount += 1;
}
}
}
}
Please see attached file with this email.
Thanks
1. I am trying to set back ground color for child item of panel bar but its not setting.
2. How can i remove hover style for panel bar. I don't want hover style on Panel bar.
3. I want to see multiple items but once i click on different panel bar it collapse. so how can i see multiple items. I wrote following code still its not working.
ExpandMode = PanelBarExpandMode.MultipleExpandedItems
Ascs code
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<telerik:RadCodeBlock ID="rcbCycleChangeHistoryCodeBlock" runat="server">
<style type="text/css">
.RadPanelBar_Windows7 .rpOut
{
background-color: #AC0000;
font-weight: bold;
font-family: Verdana,Helvetica,Calibri;
font-size: 10px;
color: #FFFFFF;
background-color: #AC0000;
}
</style>
</telerik:RadCodeBlock>
<telerik:RadAjaxPanel ID="rapCycleHistory" runat="server">
</telerik:RadAjaxPanel>
In code behind in page load
RadPanelBar cycleChangeHistory = new RadPanelBar()
{
AllowCollapseAllItems = true,
ID = "rpbCycleHistoriesItem",
RegisterWithScriptManager = true,
SkinID = "Windows7",
ViewStateMode = ViewStateMode.Inherit,
Width = Unit.Percentage(98),
CookieName = string.Format("CycleChangeHistory_{0}", base.JcnData.JcnListId),
PersistStateInCookie = true,
ExpandMode = PanelBarExpandMode.MultipleExpandedItems
};
cycleChangeHistory.ItemClick += new RadPanelBarEventHandler(rpbCycleItems_ItemClick);
rapCycleHistory.Controls.Add(cycleChangeHistory);
var changeSets = CycleChangesets.OrderByDescending(jcs => jcs.CycleChangeset);
if (0 == cycleChangeHistory.Items.Count)
{
short changeSetCount = 0;
IList<string> cycles = changeSets.Select(cs => cs.CycleNumber).ToList();
foreach (string cycle in cycles.Distinct())
{
RadPanelItem changeSetBlock = new RadPanelItem()
{
Text = string.Format("Cycle {0} ({1})", cycle, cycles.Where(c => c == cycle).Count()),
Expanded = false,
ClientIDMode = ClientIDMode.Inherit,
TabIndex = changeSetCount,
Value = string.Format("Cycle:{0}", cycle),
PostBack = true,
ChildGroupCssClass = "rpOut",
};
cycleChangeHistory.Items.Add(changeSetBlock);
changeSetCount += 1;
}
}
item click event.
protected void rpbCycleItems_ItemClick(object sender, RadPanelBarEventArgs e)
{
RadPanelItem headerItem = e.Item;
if (0 == headerItem.Controls.Count)
{
if (0 < headerItem.Value.IndexOf("|"))
{
string[] valuePieces = headerItem.Value.Split('|');
string cycleNumber = valuePieces[0].Substring((valuePieces[0].IndexOf(":") + 1));
string cycle = valuePieces[0].Substring((valuePieces[0].IndexOf(":") + 1)).Trim().Substring(valuePieces[0].Substring((valuePieces[0].IndexOf(":") + 1)).Trim().Length - 3);
int changesetId = int.Parse(valuePieces[1].Substring((valuePieces[1].IndexOf(":") + 1)));
if (Session["CycleParameters"] != null)
cycleParameters = Session["CycleParameters"] as List<CycleParameter>;
CycleParameter cp = cycleParameters.Where(p => p.cycleNumber == cycle && p.cycleChangeset == changesetId).FirstOrDefault();
GetCycleChangeHistoryData(cp.jcnListId, cp.jcnChangeset, cp.cycleId, cp.cycleChangeset, cp.cycleNumber, cp.cycleChangesetCount);
CycleChangeHistoryInformation changeSet = CycleChangesets.Where(ccs => ccs.CycleNumber.Trim() == cycle.Trim() && ccs.CycleChangeset == changesetId).FirstOrDefault();
if (changeSet.Items == null)
changeSet.Items = new List<CycleChangesetDifferenceItem>();
if (changeSet.Comments == null)
changeSet.Comments = new List<CycleChangesetCommentItem>();
IList<string> sectionHeaders = changeSet.Items.OrderBy(o => o.orderByCycleSectionName).Select(rcd => rcd.SectionName).Distinct().ToList();
Table historyInformation = new Table()
{
CellPadding = 0,
CellSpacing = 5
};
int rowCount = 0;
foreach (string section in sectionHeaders)
{
var itemfound = changeSet.Items.Where(di => di.SectionName.Equals(section)).Count();
if (itemfound == 0)
continue;
if (itemfound == 1 && string.IsNullOrEmpty(changeSet.Items.Where(di => di.SectionName.Equals(section)).FirstOrDefault().FieldName) == true)
continue;
TableHeaderRow newHeaderRow = new TableHeaderRow();
historyInformation.Rows.Add(newHeaderRow);
TableHeaderCell newHeaderCell = new TableHeaderCell()
{
ColumnSpan = 2,
Text = section
};
newHeaderRow.Cells.Add(newHeaderCell);
Table dataAreaTable = new Table()
{
BackColor = Color.FromArgb(255, 255, 255),
BorderStyle = BorderStyle.Solid,
BorderWidth = Unit.Pixel(1),
CellPadding = 5,
CellSpacing = 0
};
dataAreaTable.Style.Add("table-layout", "fixed");
TableRow dataAreaRow = new TableRow();
dataAreaRow.Cells.Add(new TableCell() { Width = Unit.Pixel(10) });
historyInformation.Rows.Add(dataAreaRow);
TableCell dataAreaCell = new TableCell();
dataAreaCell.Controls.Add(dataAreaTable);
dataAreaRow.Cells.Add(dataAreaCell);
rowCount = 0;
foreach (CycleChangesetDifferenceItem item in changeSet.Items.Where(di => di.SectionName.Equals(section)))
{
rowCount += 1;
if (1 == rowCount)
{
TableHeaderRow headerLabels = new TableHeaderRow();
dataAreaTable.Rows.Add(headerLabels);
string nextChangeset = (changeSet.CycleChangeset + 1).ToString();
if (cp.cycleChangesetCount == changeSet.CycleChangeset)
{
nextChangeset = "Current";
}
headerLabels.Cells.Add(new TableHeaderCell() { CssClass = "changeHistoryHeaderText", HorizontalAlign = HorizontalAlign.Center, Width = Unit.Pixel(175), Text = "Field" });
headerLabels.Cells.Add(new TableHeaderCell() { CssClass = "changeHistoryHeaderText", HorizontalAlign = HorizontalAlign.Center, Width = Unit.Pixel(212), Text = "Changeset " + changesetId });
headerLabels.Cells.Add(new TableHeaderCell() { CssClass = "changeHistoryHeaderText", HorizontalAlign = HorizontalAlign.Center, Width = Unit.Pixel(212), Text = "Changeset " + nextChangeset });
int headerCellCount = 0;
foreach (TableHeaderCell cell in headerLabels.Cells)
{
if (1 < (headerCellCount += 1))
cell.Style.Add("border-left", "1px #000000 solid");
}
}
if (item.FieldName != "Cycle Changeset Comments")
{
TableRow newRow = new TableRow();
dataAreaTable.Rows.Add(newRow);
newRow.Cells.Add(new TableCell() { CssClass = "applicationText", HorizontalAlign = HorizontalAlign.Left, Width = Unit.Pixel(175), Text = item.FieldName });
newRow.Cells.Add(new TableCell() { CssClass = "applicationText", HorizontalAlign = HorizontalAlign.Left, Width = Unit.Pixel(212), Text = item.ChangesetValue });
newRow.Cells.Add(new TableCell() { CssClass = "applicationText", HorizontalAlign = HorizontalAlign.Left, Width = Unit.Pixel(212), Text = item.CurrentValue });
int cellCount = 0;
foreach (TableCell cell in newRow.Cells)
{
if (1 < (cellCount += 1))
cell.Style.Add("border-left", "1px #000000 solid");
cell.Style.Add("border-top", "1px #000000 solid");
}
}
}
}
TableRow spacerRow = new TableRow();
spacerRow.Cells.Add(new TableCell() { ColumnSpan = 2, Text = " ", Height = Unit.Pixel(15) });
historyInformation.Rows.Add(spacerRow);
TableHeaderRow commentHeaderRow = new TableHeaderRow();
commentHeaderRow.Cells.Add(new TableHeaderCell() { ColumnSpan = 2, Text = "Comments" });
historyInformation.Rows.Add(commentHeaderRow);
foreach (CycleChangesetCommentItem comment in changeSet.Comments)
{
TableRow newRow = new TableRow();
newRow.Cells.Add(new TableCell() { Width = Unit.Pixel(10) });
newRow.Cells.Add(new TableCell() { Text = comment.Comment });
historyInformation.Rows.Add(newRow);
}
headerItem.Controls.Add(historyInformation);
}
else
{
string cycleNumber = headerItem.Value.Substring((headerItem.Value.IndexOf(":") + 1));
var changeSets = CycleChangesets.Where(ccs => ccs.CycleNumber == cycleNumber).OrderByDescending(ccs => ccs.CycleChangeset);
short changeSetCount = 0;
foreach (CycleChangeHistoryInformation changeSet in changeSets)
{
string nextChangeset = (changeSet.CycleChangeset + 1).ToString();
string creatorId = string.Empty;
string userDate = string.Empty;
if (null != changeSet.UpdateDate && changeSet.UpdateDate != DateTime.MinValue)
userDate = string.Format("- Date: {0}", changeSet.UpdateDate.ToShortDateString());
if (changeSets.Count() == changeSet.CycleChangeset)
{
nextChangeset = "Current";
int ccs = changeSet.CycleChangeset + 1;
creatorId = (from mu in MembershipDataProvider.LoadMembershipUsers(false)
where mu.UserId == base.JcnData.Cycles.Where(cn => cn.CycleId == changeSet.CycleId && cn.CycleChangeSet == ccs).FirstOrDefault().CycleChangeSetCreatorId
//where mu.UserId == base.CurrentUser //base.JcnData.Cycles.Where(cn => cn.CycleId == changeSet.CycleId && cn.CycleChangeSet == changeSet.CycleChangeset).FirstOrDefault().CycleChangeSetCreatorId
select string.Format("{0} {1}", mu.FirstName, mu.LastName)).FirstOrDefault();
}
else
creatorId = changeSet.CycleChangeSetCreatorId;
RadPanelItem changeSetBlock = new RadPanelItem()
{
Text = string.Format("Changeset: {0} - {1}, User: {2} {3}", changeSet.CycleChangeset, nextChangeset, creatorId, userDate),
Expanded = false,
ClientIDMode = ClientIDMode.Inherit,
TabIndex = changeSetCount,
Value = string.Format("CycleNumber:{0}|CycleChangeSet:{1}", cycleNumber, changeSet.CycleChangeset),
PostBack = true,
ClickedCssClass = "rpOut"
};
changeSetBlock.HoveredImageUrl = null;
changeSetBlock.BackColor = Color.FromArgb(173, 0, 0);
headerItem.Items.Add(changeSetBlock);
changeSetCount += 1;
}
}
}
}
Please see attached file with this email.
Thanks