If
Request("eid") <> "" Then
Dim nodeSelected As RadTreeNode = rtvEventList.FindNodeByValue(Request("eid"))
nodeSelected.Selected =
True
Dim js As String = "ScrollToSelectedNode();"
RadScriptManager.RegisterStartupScript(Page, Page.[GetType](), "nodeSelection", js, True)
End If
The node is selected and page is filled out correctly. The function ScrollToSelectedNode() is called.
function ScrollToSelectedNode()
{
var treeviewInstance = <%=rtvEventList.ClientID %>;
var selectedNode = treeviewInstance.SelectedNode;
if (selectedNode != null)
{
window.setTimeout(
function() { selectedNode.ScrollIntoView(); }, 200);
}
}
It seems that the treeviewInstance has as object, but I keep getting errors that the SelectedNode of the treeviewInstance is null. So the page will not scroll the treeview to the correct node. What am I doing wrong?
protected
void
grdTransaction_GridExporting(
object
sender, GridExportingArgs e)
{
byte
[] byteArray = Encoding.UTF8.GetBytes( e.ExportOutput);
byte
[] asciiArray = Encoding.Convert(Encoding.UTF8, Encoding.Default, byteArray);
e.ExportOutput = Encoding.ASCII.GetString(asciiArray);
}
Hello.
I have built a very simple web page (Default.aspx) with the RadScheduler component:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@ 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
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
>
<
WebServiceSettings
Path
=
"/App_Code/Service1.svc"
ResourcePopulationMode
=
"ServerSide"
/>
</
telerik:RadScheduler
>
</
div
>
</
form
>
</
body
>
</
html
>
using
System;
using
System.Runtime.Serialization;
using
System.ServiceModel;
using
System.ServiceModel.Activation;
using
System.ServiceModel.Web;
using
System.Data.Common;
using
Telerik.Web.UI;
using
System.Collections.Generic;
using
System.Data.SqlClient;
using
System.Configuration;
namespace
WebApplication1
{
[ServiceContract(Namespace =
""
)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(IncludeExceptionDetailInFaults =
true
)]
public
class
Service1
{
private
WebServiceAppointmentController _controller;
private
MyProvider _provider;
private
MyProvider Provider
{
get
{
if
(_provider ==
null
)
{
var connString = ConfigurationManager.ConnectionStrings[
"BossDB"
].ConnectionString;
var factory = DbProviderFactories.GetFactory(
"System.Data.SqlClient"
);
_provider =
new
MyProvider() { ConnectionString = connString, DbFactory = factory, PersistChanges =
true
};
}
return
_provider;
}
}
private
WebServiceAppointmentController Controller
{
get
{
if
(_controller ==
null
)
{
_controller =
new
WebServiceAppointmentController(Provider);
}
return
_controller;
}
}
[OperationContract]
public
IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo)
{
return
Controller.GetAppointments(schedulerInfo);
}
[OperationContract]
public
IEnumerable<AppointmentData> InsertAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData)
{
return
Controller.InsertAppointment(schedulerInfo, appointmentData);
}
[OperationContract]
public
IEnumerable<AppointmentData> UpdateAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData)
{
return
Controller.UpdateAppointment(schedulerInfo, appointmentData);
}
[OperationContract]
public
IEnumerable<AppointmentData> DeleteAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData,
bool
deleteSeries)
{
return
Controller.DeleteAppointment(schedulerInfo, appointmentData, deleteSeries);
}
[OperationContract]
public
IEnumerable<AppointmentData> CreateRecurrenceException(SchedulerInfo schedulerInfo, AppointmentData recurrenceExceptionData)
{
return
Controller.CreateRecurrenceException(schedulerInfo, recurrenceExceptionData);
}
[OperationContract]
public
IEnumerable<AppointmentData> RemoveRecurrenceExceptions(SchedulerInfo schedulerInfo, AppointmentData masterAppointmentData)
{
return
Controller.RemoveRecurrenceExceptions(schedulerInfo, masterAppointmentData);
}
}
}
using
System;
using
System.Collections.Generic;
using
System.Data.Common;
using
System.Data.SqlClient;
using
System.Configuration;
using
System.Transactions;
using
Telerik.Web.UI;
public
class
MyProvider : DbSchedulerProviderBase
{
private
SqlConnection m_connection;
private
SqlCommand m_cmdReservationListSelect;
public
MyProvider()
{
m_connection =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"BossDB"
].ConnectionString);
m_cmdReservationListSelect =
new
SqlCommand(
"procReservationListSelect"
);
m_cmdReservationListSelect.CommandType = System.Data.CommandType.StoredProcedure;
m_cmdReservationListSelect.Connection = m_connection;
m_cmdReservationListSelect.Parameters.Add(
new
SqlParameter(
"@ClubId"
, System.Data.SqlDbType.SmallInt));
m_cmdReservationListSelect.Parameters.Add(
new
SqlParameter(
"@ResourceType"
, System.Data.SqlDbType.Char, 15));
m_cmdReservationListSelect.Parameters.Add(
new
SqlParameter(
"@ReservationDate"
, System.Data.SqlDbType.Char, 10));
m_cmdReservationListSelect.Parameters.Add(
new
SqlParameter(
"@ReservationType"
, System.Data.SqlDbType.Char, 1));
m_cmdReservationListSelect.Parameters.Add(
new
SqlParameter(
"@MembershipNbr"
, System.Data.SqlDbType.Char, 10));
}
public
override
IEnumerable<Appointment> GetAppointments(ISchedulerInfo shedulerInfo)
{
Int16 clubId = 201;
String resourceType =
"PERS TRAINING"
;
String reservationDate =
"04/01/2011"
;
String reservationType =
"L"
;
String membershipNbr =
""
;
List<Appointment> appointments =
new
List<Appointment>();
using
(TransactionScope scope =
new
TransactionScope())
{
m_cmdReservationListSelect.Parameters[
"@ClubId"
].Value = clubId;
m_cmdReservationListSelect.Parameters[
"@ResourceType"
].Value = resourceType;
m_cmdReservationListSelect.Parameters[
"@ReservationDate"
].Value = reservationDate;
m_cmdReservationListSelect.Parameters[
"@ReservationType"
].Value = reservationType;
m_cmdReservationListSelect.Parameters[
"@MembershipNbr"
].Value = membershipNbr;
m_connection.Open();
using
(SqlDataReader reader = m_cmdReservationListSelect.ExecuteReader())
{
if
(reader.HasRows)
{
int
resource = reader.GetOrdinal(
"resource"
);
int
reservation = reader.GetOrdinal(
"reservation"
);
int
qoh = reader.GetOrdinal(
"qoh"
);
int
limit = reader.GetOrdinal(
"limit"
);
int
start_time = reader.GetOrdinal(
"start_time"
);
int
res_units = reader.GetOrdinal(
"res_units"
);
int
invtr_desc = reader.GetOrdinal(
"invtr_desc"
);
int
trainer_cust_code = reader.GetOrdinal(
"trainer_cust_code"
);
int
remaining_sessions = reader.GetOrdinal(
"remaining_sessions"
);
int
recurring = reader.GetOrdinal(
"recurring"
);
while
(reader.Read())
{
Appointment apt =
new
Appointment();
apt.ID = (!reader.IsDBNull(reservation) ? reader.GetInt32(reservation) : 0);
apt.Subject = (!reader.IsDBNull(invtr_desc) ? reader.GetString(invtr_desc) :
""
);
apt.Start = Convert.ToDateTime(
"04/01/2011 "
+ reader.GetString(start_time));
apt.End = Convert.ToDateTime(
"04/01/2011 "
+ reader.GetString(start_time)).AddHours(reader.GetInt16(res_units));
apt.RecurrenceRule =
""
;
apt.RecurrenceParentID =
null
;
appointments.Add(apt);
}
}
}
m_connection.Close();
scope.Complete();
return
appointments;
}
}
public
override
void
Insert(ISchedulerInfo shedulerInfo, Appointment appointmentToInsert)
{
if
(!PersistChanges)
{
return
;
}
}
public
override
void
Update(ISchedulerInfo shedulerInfo, Appointment appointmentToUpdate)
{
if
(!PersistChanges)
{
return
;
}
}
public
override
void
Delete(ISchedulerInfo shedulerInfo, Appointment appointmentToDelete)
{
if
(!PersistChanges)
{
return
;
}
}
}
Server Error
in
'/'
Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service
this
request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or
namespace
name
'Transactions'
does not exist
in
the
namespace
'System'
(are you missing an assembly reference?)
Source Error:
Line 4:
using
System.Data.SqlClient;
Line 5:
using
System.Configuration;
Line 6:
using
System.Transactions;
Line 7:
using
Telerik.Web.UI;
Line 8:
Line 6 is highlighted, indicating an error in statement "using System.Transactions;".
In order to compile file MyProvider.cs, System.Transactions needs to be referenced not only in the source code, but also as part of the project, under "References".
Is there another place where System.Transactions need to be referenced?
I would appreciate whether someone could assist me in solving this problem.
Thank you in advance.
Paulo
//Take the start and end dates and set them for the start and end X axis
this
.Chart1.ChartAreas[0].AxisX.Minimum = initialDate.ToOADate();
this
.Chart1.ChartAreas[0].AxisX.Maximum = completeDate.ToOADate();
//Get the total hours between start and end
double
totalSeriesHours = completeDate.Subtract(initialDate).TotalHours;
//We will be showing 8 grid lines on the X axis so keep adding an hour until we can divide evenly by 8
if
(totalSeriesHours > 0)
{
// How many hours per label?
while
((totalSeriesHours % 8.0) != 0)
{
totalSeriesHours++;
}
totalSeriesHours /= 8;
}
//Set the X axis lines, labels and tick marks.
this
.Chart1.ChartAreas[0].AxisX.MajorGrid.IntervalType = DateTimeIntervalType.Hours;
this
.Chart1.ChartAreas[0].AxisX.MajorGrid.Interval = totalSeriesHours;
this
.Chart1.ChartAreas[0].AxisX.LabelStyle.IntervalType = DateTimeIntervalType.Hours;
this
.Chart1.ChartAreas[0].AxisX.LabelStyle.Interval = totalSeriesHours;
this
.Chart1.ChartAreas[0].AxisX.MajorTickMark.Interval = totalSeriesHours;
this
.Chart1.ChartAreas[0].AxisX.MajorTickMark.IntervalType = DateTimeIntervalType.Hours;
double
minDateValue = initialDate.ToOADate();
double
maxDateValue = completeDate.ToOADate();
double
totalSeriesHours = maxDateValue - minDateValue;
//We will be showing 8 grid lines on the X axis so keep adding an hour until we can divide evenly by 8
if
(totalSeriesHours > 0)
{
// How many hours per label?
while
((totalSeriesHours % 8.0) != 0)
{
totalSeriesHours++;
}
totalSeriesHours /= 8;
}
//Take the start and end dates and set them for the start and end X axis
this
.Chart1.PlotArea.XAxis.IsZeroBased =
false
;
this
.Chart1.PlotArea.XAxis.AutoScale =
false
;
this
.Chart1.PlotArea.XAxis.AddRange(minDateValue, maxDateValue, totalSeriesHours);
I have a databound ComboBox that the application user needs to be able to 'check'. What need to do is to show the user which entries have already been 'checked', that is I need to be able to programmatically set the checked property of the items in the combobox. I can id the items to be checked, I just need the code to actually "check" the item.
Here is my code so far:
If item.IsInEditMode Then
Dim indx As Integer = ctlUserCombo.FindItemIndexByText("Test, Sabo")
Dim cmbo As RadComboBox = CType(item.FindControl("ctlUserCombo"), RadComboBox)
Dim cbox As RadComboBoxItem = CType(cmbo.Items(indx), RadComboBoxItem)
cmbo.Items(indx).Enabled = False
So I am able to change the Enabled property to False...what I need to be able to do is set the combobox to "Checked". However the RadComboBoxItem does not have a 'checked' property. Anyone know how to get the combo box to show checked = true for individual items in the combobox?
Thanks.