if (e.CommandName == RadGrid.FilterCommandName) { Pair filterPair = (Pair)e.CommandArgument; if (filterPair.Second.ToString() == "DateCreated") { string colName = filterPair.Second.ToString(); TextBox tbPattern = (e.Item as GridFilteringItem)[colName].Controls[0] as TextBox; string[] values = tbPattern.Text.Split(' '); if (values.Length == 2) { e.Canceled = true; string newFilter = "(([" + filterPair.Second + "] >='" + values[0] + "') AND ([" + filterPair.Second + "] <='" + values[1] + "'))"; if (taskGrid.MasterTableView.FilterExpression == "") { taskGrid.MasterTableView.FilterExpression = "('" + startDate1.Value.ToString("MM/dd/yyyy HH:mm:ss") + "' <= [DateCreated] AND [DateCreated] <= '" + endDate1.Value.ToString("MM/dd/yyyy HH:mm:ss") + "')" + newFilter; } else { taskGrid.MasterTableView.FilterExpression += " AND ('" + startDate1.Value.ToString("MM/dd/yyyy HH:mm:ss") + "' <= [DateCreated] AND [DateCreated] <= '" + endDate1.Value.ToString("MM/dd/yyyy HH:mm:ss") + "' )"; } } } }function OnRequestStart(sender, args) { //get a reference to the current RadWindow var oWnd = GetRadWindow(); args.set_eventArgument(oWnd["EmailAddress"]); } <telerik:RadPanelBar ID="RadPanelBar1" runat="server">
<Items>
<telerik:RadPanelItem runat="server" Text="Activities">
<Items>
<telerik:RadPanelItem runat="server" Value="templateHolder">
<ItemTemplate>
<asp:CheckBox ID="CheckBox2" runat="server" />
</ItemTemplate>
</telerik:RadPanelItem>
</Items>
</telerik:RadPanelItem>
</Items>
</telerik:RadPanelBar>
This is my .ascx.cs file:
public override void DoLayout( )
{
//Get collection
TrackableCollection<ProjectActivityBooking> acitivities = existingRegistration.ProjectParticipant.ProjectEntity.ProjectActivityBooking;
//Here it is possible to get hold of the checkbox
CheckBox cb = RadPanelBar1.FindItemByValue("templateHolder").FindControl("CheckBox2") as CheckBox;
//Add datasource and bind
this.RadPanelBar1.ItemDataBound += new RadPanelBarEventHandler(itemDatabound);
this.RadPanelBar1.DataSource = acitivities;
this.RadPanelBar1.DataBind();
}
The code below let me add a new instatited CheckBox, but it is not added as subitem. Instead I´m getting a "static" RadPanelBar without the nice feature of being pushed and sliding out the subitems ie. activities
void itemDatabound(Object sender, RadPanelBarEventArgs e)
{
//Get panelItem
RadPanelItem item = (RadPanelItem)e.Item;
//Create Checkbox
CheckBox chk = new CheckBox();
//Get Activity
ProjectActivityBooking activity = item.DataItem as ProjectActivityBooking;
//Set activity name
chk.Text = activity.ProjectActivity.ActivityName;
//Add control
item.Controls.Add(chk);
}
I think the way forward is something like below, but that will not get me my CheckBox.
void itemDatabound(Object sender, RadPanelBarEventArgs e)
{
//This will throw an exception
//CheckBox cb1 = RadPanelBar1.FindItemByValue("templateHolder").FindControl("CheckBox2") as CheckBox;
//This will return null as it will now find the templateHolder RadPanel item
//How will I then get hold of the CheckBox2 when the templateholder do not find/returns null
//RadPanelItem item = e.Item.FindControl("templateHolder") as RadPanelItem;
}
Please let me know what I´ve done wrong?
Best Regards,
Thomas Andersson
Hi,
I am using a MOSSradEditor inside the following control hirarchy:
Sharepoint Web part
- - - - Web user control
- - - - - - - - Rad Dock
- - - - - - - - - - - - MOSSRadEditor.
I would like to have ModeChange event of the MOSSRadEditor on the server side. For this purpose I handle the ClientModeChange event and then use RadAjaxManager to send the ajaxrequest to the server. But the method $find returns null in the line:
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
Therefore I receive the javascript error Error: 'null' is null or not an object on the next line:
ajaxManager.ajaxRequest(operation);
Can you pleae let me know how I can solve this problem,
or proposing any pther way to have ModeChange event on the server side?
Here is the code section.
<%
@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditFormUI.ascx.cs"
Inherits="EditingTools.Core.EditFormUI" %>
<%
@ Register Assembly="Telerik.Web.UI, Version=2010.2.826.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%
@ Register Assembly="RadEditorSharePoint, Version=5.8.1.0, Culture=neutral, PublicKeyToken=1f131a624888eeed"
Namespace="Telerik.SharePoint" TagPrefix="telerikSP" %>
<
asp:ScriptManager ID="ScriptManager1" runat="server">
</
asp:ScriptManager>
<
telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
</
telerik:RadAjaxManager>
<
telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
function ajaxRequest(operation) {
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
ajaxManager.ajaxRequest(operation);
}
</script>
</
telerik:RadScriptBlock>
<
telerik:RadDockLayout ID="RadDockLayout1" runat="server">
<telerik:RadDockZone ID="dockZone" runat="server" Orientation="Vertical" Width="100%"
FitDocks="true">
<telerik:RadDock ID="dockAma" runat="server" >
<ContentTemplate>
<telerikSP:MOSSRadEditor ID="EditorAma" runat="server" OnClientModeChange="Editor_ModeChange">
<Content>
</Content>
</telerikSP:MOSSRadEditor>
</ContentTemplate>
</telerik:RadDock>
</telerik:RadDockZone>
</
telerik:RadDockLayout>
<
script type="text/javascript">
RadEditorCommandList[
"Save"] = function (commandName, editor, oTool) {
ajaxRequest(
"Save" );
}
RadEditorCommandList[
"Cancel"] = function (commandName, editor, oTool) {
ajaxRequest(
"Cancel");
}
function Editor_ModeChange(editor, args) {
var mode = editor.get_mode();
switch (mode) {
case 1:
ajaxRequest(
"Design" );
break;
case 4:
ajaxRequest(
"Preview" );
}
}
</
script>
Thank you in advance.