<telerik:RadGrid ID="AssessmentGrid" runat="server" ShowHeader="True" ShowFooter="true"
BorderWidth="1" CellPadding="3" AutoGenerateColumns="false" Width="600px" Skin="WebBlue"
AllowPaging="true" PageSize="10" AllowCustomPaging="true" VirtualItemCount="50"
AllowMultiRowSelection="true" OnNeedDataSource="AssessmentGrid_NeedDataSource"
OnPreRender="AssessmentGrid_PreRender" OnUpdateCommand="AssessmentGrid_UpdateCommand"
EnableAJAX="true" ShowStatusBar="true" EnableEmbeddedSkins="false" OnRowDrop="AssessmentGrid_RowDrop">
<PagerStyle Mode="NumericPages" />
<MasterTableView ShowFooter="true" DataKeyNames="assessment_plan_reference" EditMode="PopUp"
EditFormSettings-PopUpSettings-Width="600px" EditFormSettings-PopUpSettings-Height="700px">
<RowIndicatorColumn Visible="true" UniqueName="RowIndicator">
<HeaderStyle Width="20px" BackColor="LightSkyBlue" />
</RowIndicatorColumn>
<Columns>
<telerik:GridEditCommandColumn HeaderText="Edit" HeaderStyle-Width="40px" ItemStyle-Width="40px">
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn UniqueName="assessment_plan_reference" DataField="assessment_plan_reference"
Visible="false" runat="server" ItemStyle-Width="50px" ReadOnly="true" />
<telerik:GridBoundColumn UniqueName="week_number" DataField="week_number" HeaderText="Week"
HeaderStyle-HorizontalAlign="left" HeaderStyle-Width="70px" ItemStyle-Width="70px"
runat="server" ReadOnly="true" />
<telerik:GridBoundColumn HeaderText="Content" UniqueName="content" DataField="content"
runat="server">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Activity" UniqueName="activity" DataField="activity"
runat="server">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings CaptionFormatString="Edit Plan: {0}" CaptionDataField="assessment_plan_reference"
EditFormType="Template">
<EditColumn UniqueName="EditCommandColumn1">
</EditColumn>
<FormTemplate>
<table id="Table1" cellspacing="1" cellpadding="10" width="400px" border="1" style="border-collapse: collapse;
border-width: 2px; background: white;">
<tr>
<td>
</td>
</tr>
<tr>
<td>
Week
<asp:Label ID="lblWeekno" runat="server" Text='<%#Bind("week_number")%>' />
</td>
</tr>
<tr>
<td>
Content
<br />
<telerik:RadEditor ID="RadEditor1" runat="server" Content='<%# Bind("content") %>'
ToolsFile="WebBlue/ToolsFile.xml" Height="200px" Width="350px" Skin="WebBlue" />
</td>
</tr>
<tr>
<td>
Activity
<br />
<telerik:RadEditor ID="RadEditor2" runat="server" Content='<%# Bind("activity") %>'
ToolsFile="WebBlue/ToolsFile.xml" Height="200px" Width="350px" Skin="WebBlue" />
</td>
</tr>
<tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="btnUpdate" Text='Update' runat="server" CommandName='Update'></asp:Button>
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
CommandName="Cancel"></asp:Button>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
<ClientSettings AllowRowsDragDrop="True" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
<Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
<Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
<ClientEvents OnRowDropping="onRowDropping" />
</ClientSettings>
</telerik:RadGrid>
" contained "FireCommand:ctl00$MainContent$MyGrid$ctl00;Filter;Subject|a and b|Contains
". So here we have again semicolon and "and". Probably that's the reason for the denial.
I have a multi-column comboBox which allows custom text and has "EnableLoadOnDemand" set to true. I want to populate the columns (4 in total) with a list of search results, based on an active directory search method (which returns UserID, Name, Email, Line Manager)
At present, the method works great when the user enters a surname into the text property and clicks a "Search" button (the method is assigned to the OnClick event of the button, obviously.)
What I would like to happen is for the user to enter the first few letters of a surname and the multi-column combobox will load the results on demand.
The results do not come from a datasource, as explained above.
Would this behaviour be possible at all?
As a framework, I have similar code structure to the example found here
Thanks.
Markup:
<
telerik:RadComboBox
ID
=
"UserIDComboBox"
runat
=
"server"
AllowCustomText
=
"True"
DropDownWidth
=
"400px"
MarkFirstMatch
=
"True"
EnableLoadOnDemand
=
"true"
OnItemsRequested
=
"UserID_ItemsRequested"
OnItemDataBound
=
"UserID_ItemsDataBound"
ToolTip
=
"Type first 3 letters of Surname and click Search."
Width
=
"200px"
>
<
HeaderTemplate
>
<
ul
>
<
li
class
=
"col1"
>User_ID</
li
>
<
li
class
=
"col2"
>Name</
li
>
<
li
class
=
"col3"
>Email</
li
>
<
li
class
=
"col4"
>Line Manager</
li
>
</
ul
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
ul
>
<
li
class
=
"col1"
>
<%# DataBinder.Eval(Container.DataItem, "UserId") %>
</
li
>
<
li
class
=
"col2"
>
<%# DataBinder.Eval(Container.DataItem, "Name")%>
</
li
>
<
li
class
=
"col3"
>
<%# DataBinder.Eval(Container.DataItem, "Email") %>
</
li
>
<
li
class
=
"col4"
>
<%# DataBinder.Eval(Container.DataItem, "Line Manager") %>
</
li
>
</
ul
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
C#
protected void UserID_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
List<
User
> searchResults = null;
//AD Search (uncomment to test)
ADSearch ads = new ADSearch();
searchResults = ads.SearchAD(UserIDComboBox.Text, UserName, Password);
if (null == searchResults)
{
UserIDComboBox.Text = "No User Found";
}
else
{
foreach (User adu in searchResults)
{
"UserID field" = adu.UserId;
"Name field" = adu.Name;
"Email field" = adu.Email;
"Manager field" = adu.Manager;
}
}
}
protected void UserID_ItemsDataBound(object sender, RadComboBoxItemEventArgs e)
{
e.Item.Text = ((DataRowView)e.Item.DataItem)["UserId"].ToString();
e.Item.Text = ((DataRowView)e.Item.DataItem)["Name"].ToString();
e.Item.Text = ((DataRowView)e.Item.DataItem)["Email"].ToString();
e.Item.Text = ((DataRowView)e.Item.DataItem)["Manager"].ToString();
}
<
asp:Panel
runat
=
"server"
ID
=
"AdvancedControlsPanel"
CssClass
=
"rsAdvMoreControls"
>
<
label
>
Type:
</
label
>
<!--
-->
<
asp:Panel
runat
=
"server"
ID
=
"pnlUsers"
>
<
label
>
Users:</
label
><
br
/>
Search for users
<
asp:DropDownList
ID
=
"ddlOrganisation"
runat
=
"server"
OnSelectedIndexChanged
=
"ddlOrganisation_SelectedIndexChanged"
AutoPostBack
=
"true"
>
</
asp:DropDownList
>
Sections
<
asp:DropDownList
ID
=
"ddlSections"
runat
=
"server"
OnSelectedIndexChanged
=
"ddlSections_SelectedIndexChanged"
AutoPostBack
=
"true"
>
</
asp:DropDownList
>
<
asp:CheckBoxList
runat
=
"server"
ID
=
"chkUsers"
>
</
asp:CheckBoxList
>
</
asp:Panel
>
<
asp:Panel
runat
=
"server"
ID
=
"ResourceControls"
>
</
asp:Panel
>
</
asp:Panel
>
sm1.RegisterScriptControl(ajaxpnl);
script controls may not be registered before PreRender
function getSelectedItemValue(combobox, args)
{
var value = combobox.get_value();
var editor = $find("<%=RadEditor1.ClientID%>");
editor.pasteHtml(value);
}
protected
void
RadGrid1_NeedDataSource(
object
source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
LoadGrid1();
}
private
void
LoadGrid1()
{
string
sql = GetSQL();
DB2Connection connection =
new
DB2Connection(WebConfigurationManager.ConnectionStrings[
"TX"
].ConnectionString);
DB2DataAdapter dataAdapter =
new
DB2DataAdapter(sql, connection);
DataTable dataTable =
new
DataTable();
using
(connection)
{
dataAdapter.Fill(dataTable);
}
RadGrid1.DataSource = dataTable;
}
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowPaging
=
"true"
AllowFilteringByColumn
=
"true"
AutoGenerateColumns
=
"false"
PageSize
=
"20"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
OnSelectedIndexChanged
=
"RadGrid1_SelectedIndexChanged"
>
<
MasterTableView
DataKeyNames
=
"invoice_id"
>
<
Columns
>
<
telerik:GridButtonColumn
Text
=
"Details"
CommandName
=
"Select"
/>
<
telerik:GridBoundColumn
DataField
=
"invoice_id"
HeaderText
=
"Invoice ID"
/>
<
telerik:GridBoundColumn
DataField
=
"x12_id"
HeaderText
=
"X12 ID"
/>
<
telerik:GridBoundColumn
DataField
=
"st_id"
HeaderText
=
"ST ID"
/>
<
telerik:GridBoundColumn
DataField
=
"invoice_num"
HeaderText
=
"Invoice #"
/>
<
telerik:GridBoundColumn
DataField
=
"invoice_dt"
HeaderText
=
"Invoice Date"
DataFormatString
=
"{0:MM/dd/yyyy}"
/>
<
telerik:GridBoundColumn
DataField
=
"po_num"
HeaderText
=
"PO #"
/>
<
telerik:GridBoundColumn
DataField
=
"po_dt"
HeaderText
=
"PO Date"
DataFormatString
=
"{0:MM/dd/yyyy}"
/>
<
telerik:GridBoundColumn
DataField
=
"vendor_id"
HeaderText
=
"Vendor ID"
/>
<
telerik:GridBoundColumn
DataField
=
"vendor_duns"
HeaderText
=
"Vendor DUNS #"
/>
<
telerik:GridBoundColumn
DataField
=
"user_flg1"
HeaderText
=
"Type"
/>
<
telerik:GridBoundColumn
DataField
=
"user_flg2"
HeaderText
=
"EDI Type"
/>
<
telerik:GridBoundColumn
DataField
=
"total_amt"
HeaderText
=
"Amount"
/>
<
telerik:GridBoundColumn
DataField
=
"num_lines"
HeaderText
=
"Lines"
/>
<
telerik:GridBoundColumn
DataField
=
"store_num"
HeaderText
=
"Store #"
/>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
EnableRowHoverStyle
=
"true"
/>
</
telerik:RadGrid
>