I need to create a rasScheduler dynamically from code, I need to change the header template is it possible to replicate the below snippet in code and assign it to the scheduler dynamically.
<
ResourceHeaderTemplate
>
<
asp:Panel
ID
=
"ResourceWrapper"
runat
=
"server"
>
<
asp:Label
ID
=
"AgentLabel"
runat
=
"server"
Text='<%# Eval("Text") %>' />
</
asp:Panel
>
</
ResourceHeaderTemplate
>
<
telerik:RadGrid ID="rgSessionClientsNested" runat="server" CellSpacing="0" OnItemCommand="rgSessionClientsNested_ItemCommand"
DataSourceID="ObjectDataSource4" GridLines="None" Height="800px">
<
MasterTableView AutoGenerateColumns="False" DataKeyNames="client_identity"
DataSourceID="ObjectDataSource4">
<
CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<
RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<
HeaderStyle Width="20px"></HeaderStyle>
</
RowIndicatorColumn>
<
ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<
HeaderStyle Width="20px"></HeaderStyle>
</
ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="client_identity" DataType="System.Int32"
FilterControlAltText="Filter client_identity column"
HeaderText="client_identity" ReadOnly="True" SortExpression="client_identity"
UniqueName="client_identity">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="client_name"
FilterControlAltText="Filter client_name column" HeaderText="client_name"
SortExpression="client_name" UniqueName="client_name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="client_id"
FilterControlAltText="Filter client_id column" HeaderText="client_id"
SortExpression="client_id" UniqueName="client_id">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="address_1"
FilterControlAltText="Filter address_1 column" HeaderText="address_1"
SortExpression="address_1" UniqueName="address_1">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="address_2"
FilterControlAltText="Filter address_2 column" HeaderText="address_2"
SortExpression="address_2" UniqueName="address_2">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="notes"
FilterControlAltText="Filter notes column" HeaderText="notes"
SortExpression="notes" UniqueName="notes">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="forbidCnt"
FilterControlAltText="Filter forbidCnt column" HeaderText="forbidCnt"
ReadOnly="True" SortExpression="forbidCnt" UniqueName="forbidCnt">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="authorize" UniqueName="authorize">
<ItemTemplate>
<asp:RadioButtonList id="RadioButtonListClient1" AutoPostBack="True" RepeatDirection="Horizontal" runat="server">
<asp:ListItem Text="approve" Value="A" Selected="False" />
<asp:ListItem Text="forbid" Value="F" Selected="False" />
<asp:ListItem Text="assign" Value="N" Selected="False" />
</asp:RadioButtonList>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<NestedViewSettings runat="server"
DataSourceID="ObjectDataSource5">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="client_identity" MasterKeyField="client_identity" />
</ParentTableRelation>
</NestedViewSettings>
<NestedViewTemplate>
<telerik:RadGrid ID="rgSessionMattersNested" runat="server" CellSpacing="0"
DataSourceID="ObjectDataSource5" GridLines="None" >
<
MasterTableView AutoGenerateColumns="False" DataKeyNames="matter_id" DataSourceID="ObjectDataSource5">
<
CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<
RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<
HeaderStyle Width="20px"></HeaderStyle>
</
RowIndicatorColumn>
<
ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<
HeaderStyle Width="20px"></HeaderStyle>
</
ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="matter_id" DataType="System.Int32"
FilterControlAltText="Filter matter_id column" HeaderText="Matter Id"
ReadOnly="True" SortExpression="matter_id" UniqueName="matter_id" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="matter_num"
FilterControlAltText="Filter matter_num column" HeaderText="Matter Number"
SortExpression="matter_num" UniqueName="matter_num">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="matter_name"
FilterControlAltText="Filter matter_name column" HeaderText="Matter Name"
SortExpression="matter_name" UniqueName="matter_name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="abstract"
FilterControlAltText="Filter abstract column" HeaderText="Abstract"
SortExpression="abstract" UniqueName="abstract">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="destroy_after" DataType="System.DateTime"
FilterControlAltText="Filter destroy_after column" HeaderText="Destroy After"
SortExpression="destroy_after" UniqueName="destroy_after">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="client_identity" DataType="System.Int32"
FilterControlAltText="Filter client_identity column"
HeaderText="client_identity" SortExpression="client_identity"
UniqueName="client_identity" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="forbidCnt"
FilterControlAltText="Filter forbidCnt column" HeaderText="forbidCnt"
ReadOnly="True" SortExpression="forbidCnt" UniqueName="forbidCnt" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="authorize" UniqueName="Authorize">
<ItemTemplate>
<asp:RadioButtonList id="RadioButtonListClient2" AutoPostBack="True" RepeatDirection="Horizontal" runat="server">
<asp:ListItem Text="approve" Value="A" Selected="False" />
<asp:ListItem Text="forbid" Value="F" Selected="False" />
<asp:ListItem Text="assign" Value="N" Selected="False" />
</asp:RadioButtonList>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<NestedViewSettings runat="server"
DataSourceID="ObjectDataSource6">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="matter_id" MasterKeyField="matter_id" />
</ParentTableRelation>
</NestedViewSettings>
<NestedViewTemplate>
<
telerik:RadGrid ID="rgSessionFilesNested" runat="server" CellSpacing="0"
DataSourceID="ObjectDataSource6" GridLines="None">
<
MasterTableView AutoGenerateColumns="False" DataKeyNames="file_id" DataSourceID="ObjectDataSource6">
<
CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<
RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<
HeaderStyle Width="20px"></HeaderStyle>
</
RowIndicatorColumn>
<
ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<
HeaderStyle Width="20px"></HeaderStyle>
</
ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="file_id" DataType="System.Int32"
FilterControlAltText="Filter file_id column" HeaderText="File Id"
ReadOnly="True" SortExpression="file_id" UniqueName="file_id" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="file_number"
FilterControlAltText="Filter file_number column" HeaderText="File Number"
ReadOnly="True" SortExpression="file_number" UniqueName="file_number">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="subfile_desc"
FilterControlAltText="Filter subfile_desc column" HeaderText="File Name"
SortExpression="subfile_desc" UniqueName="subfile_desc">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="title"
FilterControlAltText="Filter title column" HeaderText="File Status"
SortExpression="title" UniqueName="title">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="redweld_id" DataType="System.Int32"
FilterControlAltText="Filter redweld_id column" HeaderText="redweld_id"
SortExpression="redweld_id" UniqueName="redweld_id" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="FileType"
FilterControlAltText="Filter FileType column" HeaderText="File Type"
SortExpression="FileType" UniqueName="FileType">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="matter_id" DataType="System.Int32"
FilterControlAltText="Filter matter_id column" HeaderText="matter_id"
SortExpression="matter_id" UniqueName="matter_id" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="redweld_num" DataType="System.Int32"
FilterControlAltText="Filter redweld_num column" HeaderText="Redweld Number"
ReadOnly="True" SortExpression="redweld_num" UniqueName="redweld_num">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="forbidCnt"
FilterControlAltText="Filter forbidCnt column" HeaderText="forbidCnt"
SortExpression="forbidCnt" UniqueName="forbidCnt" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Authorize" UniqueName="authorize">
<ItemTemplate>
<asp:RadioButtonList id="RadioButtonListClient3" AutoPostBack="True" RepeatDirection="Horizontal" runat="server">
<asp:ListItem Text="approve" Value="A" Selected="False" />
<asp:ListItem Text="forbid" Value="F" Selected="False" />
<asp:ListItem Text="assign" Value="N" Selected="False" />
</asp:RadioButtonList>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<
EditFormSettings>
<
EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</
EditFormSettings>
</
MasterTableView>
<
FilterMenu EnableImageSprites="False">
<
WebServiceSettings>
<
ODataSettings InitialContainerName=""></ODataSettings>
</
WebServiceSettings>
</
FilterMenu>
<
HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
<
WebServiceSettings>
<
ODataSettings InitialContainerName=""></ODataSettings>
</
WebServiceSettings>
</
HeaderContextMenu>
</telerik:RadGrid>
</NestedViewTemplate>
<
EditFormSettings>
<
EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</
EditFormSettings>
</
MasterTableView>
<
FilterMenu EnableImageSprites="False">
<
WebServiceSettings>
<
ODataSettings InitialContainerName=""></ODataSettings>
</
WebServiceSettings>
</
FilterMenu>
<
HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
<
WebServiceSettings>
<
ODataSettings InitialContainerName=""></ODataSettings>
</
WebServiceSettings>
</
HeaderContextMenu>
</telerik:RadGrid>
</NestedViewTemplate>
<
EditFormSettings>
<
EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</
EditFormSettings>
</
MasterTableView>
<
FilterMenu EnableImageSprites="False">
<
WebServiceSettings>
<
ODataSettings InitialContainerName=""></ODataSettings>
</
WebServiceSettings>
</
FilterMenu>
<
HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
<
WebServiceSettings>
<
ODataSettings InitialContainerName=""></ODataSettings>
</
WebServiceSettings>
</
HeaderContextMenu>
</telerik:RadGrid>
<
telerik:RadAjaxManager
runat
=
"server"
ID
=
"rdAjaxManager"
OnAjaxRequest
=
"rdAjaxManager_AjaxRequest"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"rdAjaxManager"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"rdgdPartnerImportCode"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
I would like to use the XmlHttpPanel to display some content and I am trying to minimise server load.
I have a set of imagebuttons within a repeater control. Its the first time I've used the XmlHttpPanel. The XmlHttpPanel displays information from a specific database record defined by InfoId. I can set the repeater datasource with information containing InfoId. I could set the commandArgument for the buttons to '<%# Eval("InfoId") %>' but that would then involve a postback to execute an OnCommand event. I therefore assume that it would be more efficient (a little like the First Look example in the demos) to have the imagebutton OnClientClick execute a javascript function that then sets the XmlHttpPanel value to the correct InfoId and the panel can then get the required information.
I have two questions: (1) am I write that dealing with the button click in javascript rather than a command postback would be more efficient and (2) that being the case can someone help me with how to set the OnClientClick property of the imagebutton in the repeater. I keep getting messages that the tag isn't well formed or some other error.
I'm assuming that the following javascript is fine (and it works if I hard code the OnClientClick property for a button):
<script type="text/javascript">
function myClientClick(index)
{
var myControl = $find("<%= myXmlHttpPanel.ClientID %>");
myControl.set_value(index);
return false;
}
</script>
However, to make this work I need the OnClientClick property to be of the form: "return OnAdditionalSelect('x')" where x is the InfoId. If I use Eval("InfoId") I get errors and putting \' to try to get the single quotes around the id also causes a "tag not well formed" error.
CODE BEHIND
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace PortalWeb.Partners.Communications
{
public class Person
{
public int RecipientID;
public string RecipientName;
public string RecipientType;
public string CompanyName;
public string ProgramName;
public Person(int RecipientID, string RecipientName, string RecipientType, string CompanyName, string ProgramName)
{
this.RecipientID = RecipientID;
this.RecipientName = RecipientName;
this.RecipientType = RecipientType;
this.CompanyName = CompanyName;
this.ProgramName = ProgramName;
}
}
public partial class recipients : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadGrdidRecipientList_Databound(object sender, RadListBoxItemEventArgs e)
{
// Dummy Data //
List<
Person
> MyData = new List<
Person
>();
MyData.Add(new Person(1, "John Doe", "OptIn", "FrogJoy", "UIRR"));
MyData.Add(new Person(1, "Jane Doe", "OptIn", "YouTube", "TYRR"));
MyData.Add(new Person(1, "Jillian Doe", "OptIn", "Intel", "FREE"));
MyData.Add(new Person(1, "Happy Joe", "OptIn", "Hello Kitty", "POLG"));
MyData.Add(new Person(1, "Rob Crandle", "OptOut", "McDonalds", "NYTH"));
RadGrid myFilterGrid = new RadGrid();
myFilterGrid = e.Item.FindControl("RecipientsGrid") as RadGrid;
myFilterGrid.DataSource = MyData;
myFilterGrid.DataBind();
}
}
}
ASPX PAGE
<
telerik:RadListBox
ID
=
"RecipientFilterList"
runat
=
"server"
OnItemDataBound
=
"RadGrdidRecipientList_Databound"
Width
=
"450px"
Height
=
"300px"
SelectionMode
=
"Multiple"
AllowTransfer
=
"true"
TransferToID
=
"RecipientSelectList"
AutoPostBackOnTransfer
=
"true"
AllowReorder
=
"true"
AutoPostBackOnReorder
=
"true"
EnableDragAndDrop
=
"true"
>
<
ItemTemplate
>
<
telerik:RadGrid
ID
=
"RecipientsGrid"
runat
=
"server"
AllowFilteringByColumn
=
"True"
GroupingSettings-CaseSensitive
=
"false"
AllowPaging
=
"True"
AllowSorting
=
"True"
GridLines
=
"Horizontal"
AutoGenerateColumns
=
"false"
ShowHeader
=
"true"
PageSize
=
"50"
MasterTableView-Width
=
"100%"
>
<
HeaderStyle
Font-Bold
=
"true"
Font-Italic
=
"False"
Font-Overline
=
"False"
Font-Strikeout
=
"False"
Font-Underline
=
"False"
ForeColor
=
"#333333"
Wrap
=
"False"
/>
<
AlternatingItemStyle
BackColor
=
"#EEEEEE"
Font-Bold
=
"False"
Font-Italic
=
"False"
Font-Overline
=
"False"
Font-Strikeout
=
"False"
Font-Underline
=
"False"
Wrap
=
"True"
/>
<
MasterTableView
AllowFilteringByColumn
=
"True"
ItemStyle-Width
=
"100%"
NoMasterRecordsText
=
"No Recipients Found"
NoDetailRecordsText
=
"No Recipients Found"
Visible
=
"true"
ShowHeadersWhenNoRecords
=
"true"
>
<
NoRecordsTemplate
>
<
div
align
=
"center"
>
No Recipients Found</
div
>
</
NoRecordsTemplate
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"RecipientName"
HeaderText
=
"Recipients"
UniqueName
=
"RecipientName"
SortExpression
=
"RecipientName"
ShowSortIcon
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"RecipientType"
HeaderText
=
"Type"
UniqueName
=
"RecipientType"
SortExpression
=
"RecipientType"
ShowSortIcon
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CompanyName"
SortExpression
=
"CompanyName"
HeaderText
=
"Companies"
UniqueName
=
"CompanyName"
ItemStyle-HorizontalAlign
=
"left"
ShowSortIcon
=
"false"
HeaderStyle-HorizontalAlign
=
"left"
HeaderStyle-Wrap
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ProgramName"
HeaderText
=
"Programs"
UniqueName
=
"ProgramName"
ShowSortIcon
=
"false"
ItemStyle-HorizontalAlign
=
"Left"
SortExpression
=
"NumberContacts"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"RecipientID"
Visible
=
"false"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
AllowColumnsReorder
=
"False"
ReorderColumnsOnClient
=
"False"
>
</
ClientSettings
>
</
telerik:RadGrid
>
</
ItemTemplate
>
</
telerik:RadListBox
>
<
telerik:RadListBox
ID
=
"RecipientSelectList"
runat
=
"server"
Width
=
"450px"
Height
=
"300px"
SelectionMode
=
"Multiple"
AllowReorder
=
"true"
AutoPostBackOnReorder
=
"true"
EnableDragAndDrop
=
"true"
>
<
Items
>
</
Items
>
</
telerik:RadListBox
>