Hi,
How can i find the last row of a rad grid and make the last row bold.
I Have a rad grid in which iam fetching the total from the database itself as in attached file. I do not want to add the footer and use aggregate function
Thanks in advance
Sushanth.B
<telerik:RadGrid ID="Grid1" runat="server" AllowFilteringByColumn="True" |
AllowPaging="True" OnNeedDataSource="Grid1_NeedDataSource" AllowSorting="True" |
GridLines="None" ShowGroupPanel="True" AutoGenerateColumns="true" PageSize="50" |
Skin="Telerik" Visible="false" Width="98%"> |
<MasterTableView AutoGenerateColumns="False" > |
<Columns> |
</Columns> |
</MasterTableView> |
<ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True"> |
</ClientSettings> |
</telerik:RadGrid> |
|
I have a radgrid which is set to "GroupsDefaultExpanded=False" in the MasterTableView. When a user expands one of the groups they can edit a row within that group which opens a radwindow so they can make changes. Once they close the RadWindow and it returns to the original page, all of the groups are back to being collapsed, but the user wants the original group they were working on to remain expanded. I am using vb.net and aspx pages. How can I expand the original group when returning from the RadWindow?
RadWindow Code:
<
script
type
=
"text/javascript"
>
function RefreshData(oWnd, eventArgs) {
<%=Page.ClientScript.GetPostBackEventReference(btnRefresh, "")%>
}
</
script
>
<
telerik:RadWindow
ID
=
"rwEditAttendance"
Behaviors
=
"Close"
VisibleStatusbar
=
"false"
AutoSize
=
"true"
EnableViewState
=
"false"
runat
=
"server"
Modal
=
"true"
VisibleOnPageLoad
=
"false"
OnClientClose
=
"RefreshData"
/>
<
asp:Button
runat
=
"Server"
ID
=
"btnRefresh"
style
=
"display:none; width:0px; height:0px;"
/>
Table code:
<
telerik:RadGrid
ID
=
"rgAttendanceManager"
runat
=
"server"
AllowFilteringByColumn
=
"False"
AllowSorting
=
"True"
ShowGroupPanel
=
"False"
AutoGenerateColumns
=
"False"
BorderColor
=
"Silver"
>
<
MasterTableView
GridLines
=
"None"
Width
=
"100%"
NoDetailRecordsText
=
"No data matching criteria specified"
NoMasterRecordsText
=
"No data matching criteria specified"
EnableNoRecordsTemplate
=
"true"
DataKeyNames
=
"EmployeeId,EventDate,TimecardCommentId,TCUniqueId,Modified"
ShowGroupFooter
=
"true"
GroupsDefaultExpanded
=
"false"
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"EmployeeName"
HeaderValueSeparator
=
""
HeaderText
=
" "
/>
</
SelectFields
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"EmployeeName"
/>
</
GroupByFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
<
Columns
>
<
telerik:GridButtonColumn
UniqueName
=
"EditComment"
Text
=
"Edit Comment"
ButtonType
=
"LinkButton"
CommandName
=
"EditComment"
/>
<
telerik:GridDateTimeColumn
DataField
=
"EventDate"
HeaderText
=
"Event Date"
SortExpression
=
"EventDate"
HeaderStyle-Wrap
=
"false"
DataFormatString
=
"{0:d}"
/>
<
telerik:GridDateTimeColumn
DataField
=
"HistoricalDate"
HeaderText
=
"Historical Date"
SortExpression
=
"HistoricalDate"
HeaderStyle-Wrap
=
"false"
DataFormatString
=
"{0:d}"
/>
<
telerik:GridBoundColumn
DataField
=
"PaycodeName"
HeaderText
=
"Paycode Name"
SortExpression
=
"PaycodeName"
ItemStyle-Wrap
=
"false"
/>
<
telerik:GridBoundColumn
DataField
=
"CommentText"
HeaderText
=
"Comment Text"
SortExpression
=
"CommentText"
ItemStyle-Wrap
=
"false"
/>
<
telerik:GridNumericColumn
DataField
=
"CommentValue"
HeaderText
=
"Comment Value"
HeaderStyle-Wrap
=
"false"
DataType
=
"System.Decimal"
AllowRounding
=
"false"
DecimalDigits
=
"2"
Aggregate
=
"Sum"
FooterText
=
"Total Attendance Score: "
/>
<
telerik:GridDateTimeColumn
DataField
=
"PunchIn"
HeaderText
=
"Punch In"
SortExpression
=
"PunchIn"
HeaderStyle-Wrap
=
"false"
DataFormatString
=
"{0:MM/dd/yyyy HH:mm}"
/>
<
telerik:GridDateTimeColumn
DataField
=
"PunchOut"
HeaderText
=
"Punch Out"
SortExpression
=
"PunchOut"
HeaderStyle-Wrap
=
"false"
DataFormatString
=
"{0:MM/dd/yyyy HH:mm}"
/>
<
telerik:GridCheckBoxColumn
HeaderText
=
"Modified"
DataField
=
"Modified"
HeaderStyle-Wrap
=
"false"
/>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Hi There,
Is it possible to merge RadScheduler timeslots in Timeline view? I would like to display the number of appointments over two days. Currently, I managed to do this on one day only. Please see the following example code, I displayed number '7' on Mondays, what I need is to display number '7' over both Mondays and Tuesdays timeslots. Screenshot attached. Any suggestions will be greatly appreciated. Thank you!
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadSchedulerTimeLineViewModification.aspx.cs" Inherits="RadSchedulerWebForm" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
<
title
>Untitled Page</
title
>
<
style
type
=
"text/css"
>
.rsMainHeader
{
width: auto !important;
text-align:Left !important;
padding-right:5px !important;
}
.MySlotGreen
{
color: #fff !important;
text-align:center !important;
background-color:#69690a !important;
}
</
style
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
div
style
=
"width: 980px;"
>
<
telerik:RadScheduler
runat
=
"server"
ID
=
"RadScheduler1"
SelectedView
=
"TimelineView"
ShowViewTabs
=
"false"
OnTimeSlotCreated
=
"RadScheduler1_TimeSlotCreated"
OnNavigationComplete
=
"RadScheduler1_NavigationComplete"
ColumnWidth
=
"28"
StartInsertingInAdvancedForm
=
"true"
AppointmentStyleMode
=
"Default"
>
<
TimelineView
SlotDuration
=
"1"
NumberOfSlots
=
"30"
GroupBy
=
"User, Month"
GroupingDirection
=
"Vertical"
ColumnHeaderDateFormat
=
"MMM dd ddd"
HeaderDateFormat
=
"MMMM, yyyy"
/>
</
telerik:RadScheduler
>
</
div
>
</
form
>
</
body
>
</
html
>
Code Behind:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using Telerik.Web.UI.Calendar;
using Telerik.Web.UI.Calendar.View;
public partial class RadSchedulerWebForm : System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
RadScheduler1.Provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/Appointments.xml"), true);
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack & RadScheduler1.SelectedView == SchedulerViewType.TimelineView)
{
int year = RadScheduler1.SelectedDate.Year;
int month = RadScheduler1.SelectedDate.Month;
int numberOfDaysInCurrentMonth = DateTime.DaysInMonth(year, month);
RadScheduler1.SelectedDate = new DateTime(year, month, 1);
RadScheduler1.TimelineView.NumberOfSlots = numberOfDaysInCurrentMonth;
}
}
protected void RadScheduler1_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e)
{
if (RadScheduler1.SelectedView == SchedulerViewType.TimelineView)
{
int year = RadScheduler1.SelectedDate.Year;
int month = RadScheduler1.SelectedDate.Month;
int numberOfDaysInCurrentMonth = DateTime.DaysInMonth(year, month);
RadScheduler1.SelectedDate = new DateTime(year, month, 1);
RadScheduler1.TimelineView.NumberOfSlots = numberOfDaysInCurrentMonth;
}
}
protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
{
if (RadScheduler1.SelectedView == SchedulerViewType.TimelineView)
{
if (e.TimeSlot.Start.Date.DayOfWeek == DayOfWeek.Monday)
{
Label numberLabel = new Label();
numberLabel.Text = "7";
e.TimeSlot.CssClass = "MySlotGreen";
e.TimeSlot.Control.Controls.Add(numberLabel);
}
}
}
}
RadGrid Grid1 = (RadGrid)Page.Master.FindControl("Main").FindControl("RadGrid1");
Grid1.ExportSettings.OpenInNewWindow = true;
Hi,
I have a radtreeview control. I bind this during the page load event. I’d like to add some attributes to the nodes.
So far I have done this via the NodeDataBound event. However what I really need to do is store
some data from the original datatable in some attributes.
I guess to do this I need to create the radtreeview by
looping through the datable and creating the nodes individually. When I do this I can’t see a way to set the
parent IDs?
Any suggestions?
Hi,
I have integrated radslider on one ouf our website, unfortunately it was not displying after deployment, it just shows 'Decrease' and 1 only. Please help
Dileep
I have a grid with two buttons on each row, open and remove. Using OnItemCommand click the button goes to the code fine, the remove button works fine but the open button always gets the id from the first row.
This is the code that creates the two buttons, the same except for the names and images.
GridButtonColumn gridButtonColumn = new GridButtonColumn();
gridButtonColumn.ButtonType = GridButtonColumnType.ImageButton;
gridButtonColumn.ImageUrl = "~/Images/OpenLinkIcon.png";
gridButtonColumn.CommandName = "OpenLink";
gridButtonColumn.UniqueName = "OpenLink";
gridButtonColumn.Text = "Open Signup Template";
gridButtonColumn.Display = true;
gridButtonColumn.HeaderText = "";
gridButtonColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
gridButtonColumn.HeaderStyle.Width = Unit.Pixel(40);
signupGrid.MasterTableView.Columns.Add(gridButtonColumn);
gridButtonColumn = new GridButtonColumn();
gridButtonColumn.ButtonType = GridButtonColumnType.ImageButton;
gridButtonColumn.ImageUrl = "~/Images/DeleteIcon.png";
gridButtonColumn.CommandName = "Delete";
gridButtonColumn.UniqueName = "Delete";
gridButtonColumn.Text = "Remove Signup Template";
gridButtonColumn.Display = true;
gridButtonColumn.HeaderText = "";
gridButtonColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
gridButtonColumn.HeaderStyle.Width = Unit.Pixel(40);
signupGrid.MasterTableView.Columns.Add(gridButtonColumn);
This is the grid definition
<
div
id
=
"GridDiv"
runat
=
"server"
>
<
asp:panel
runat
=
"server"
ID
=
"Panel1"
CssClass
=
"windowPercent"
>
<
telerik:RadGrid
runat
=
"server"
ID
=
"SignupGrid"
OnItemCommand
=
"Grid_ItemCommand"
></
telerik:RadGrid
>
</
asp:panel
>
</
div
>
And this the aspx.cs code for the Grid_ItemCommand.
protected void Grid_ItemCommand(object source, GridCommandEventArgs e)
{
if (isPageRefresh || e == null || e.Item == null) {
return;
}
GridDataItem item = (GridDataItem)e.Item;
string strId = item[SignupListData.FIELD_ID].Text;
switch (e.CommandName) {
case "Delete":
string name = item[SignupListData.FIELD_NAME].Text;
lblConfirm.Text = "Are you sure you want to remove sigup template \"" + name + "\"?";
RemoveSignup.Value = "Yes";
RemoveId.Value = strId;
break;
case "OpenLink":
this.Response.Redirect("/Signup/Design/" + strId);
break;
}
}
The and name values for Delete is the proper one for the row, while the for OpenLink is always the FIELD_ID from the first row,
Searching the forums and examples I found several different ways of getting the field id value but none of them worked.
No idea how to fix this problem.
George
FYI: the form to post this to the forum has a buggy edit box. If I backspace once its works but further ones will skip to the front of words removing spaces unexpectedly. It was rather difficult to make this post.