I am loading a rad combo box on demand (EnableLoadOnDemand="True") in the ItemsRequested event. I want this to load when the user opens the combo box but not when they type in the combo box (I have MarkFirstMatch = true). Is this possible?
Here is the code I am using for all this if it helps:
<telerik:RadComboBox ID="RadComboBox2" CssClass="DGselectPerson" runat="server" EmptyMessage="Select a Person" EnableLoadOnDemand="True" AppendDataBoundItems="false" AutoPostBack="true" DataTextField="Name" DataValueField="RecordID" EnableVirtualScrolling="true" OnClientDropDownOpening="onDropDownOpening" OnItemsRequested="RadComboBox2_ItemsRequested" MarkFirstMatch="true">
</telerik:RadComboBox>
Protected
Sub RadComboBox2_ItemsRequested(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles RadComboBox2.ItemsRequested
RadComboBox2.DataSource = GetPeople()
RadComboBox2.DataBind()
End Sub
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" AllowSorting="true"
AllowPaging="True" PageSize="20" GridLines="None" ShowGroupPanel="false" OnNeedDataSource="RadGrid1_NeedDataSource"
OnItemCreated="RadGrid1_ItemCreated" Skin="Vista" EnableEmbeddedSkins="true"
OnItemCommand="RadGrid1_ItemCommand" OnItemDataBound="RadGrid1_ItemDataBound"
OnPreRender="RadGrid1_PreRender" Width="98%" OnDataBound="RadGrid1_DataBound">
<MasterTableView DataKeyNames="Item" Width="100%">
<NestedViewTemplate>
<asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">
<div class="border_none">
<telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0"
EnableEmbeddedBaseStylesheet="true">
<Tabs>
<telerik:RadTab Width="330px" runat="server" Text="<img src='images/SCDLlogo.gif'/> Manual Comparison - SCDL Properties"
PageViewID="PageView1">
</telerik:RadTab>
</Tabs>
<Tabs>
<telerik:RadTab Width="330px" runat="server" Text="<img src='images/LocalDecklogo.gif'/> Manual Comparison - LOCALDECK Properties"
PageViewID="PageView11">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage runat="server" Width="98%" ID="Multipage1" SelectedIndex="0"
RenderSelectedPageOnly="false">
<telerik:RadPageView runat="server" ID="PageView1">
<asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Eval("Item") %>'
Visible="false" runat="server" />
<asp:Label ID="lblLevelID" Font-Bold="true" Font-Italic="true" Text='<%# Eval("LevelID") %>'
Visible="false" runat="server" />
<asp:Label ID="lblSupplier" Font-Bold="true" Font-Italic="true" Text='<%# Eval("Supplier") %>'
Visible="false" runat="server" />
<telerik:RadGrid runat="server" ID="RadMappingGrid" DataSourceID="SqlDataSource2"
ShowHeader="true" ShowFooter="true" AllowSorting="false" EnableLinqExpressions="false"
EnableEmbeddedSkins="true" Skin="Web20" OnItemCommand="RadMappingGrid_ItemCommand"
Width="100%">
<MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
DataKeyNames="Item" Width="100%" PageSize="25" HierarchyLoadMode="ServerOnDemand">
<Columns>
<telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Property Name">
<ItemTemplate>
<asp:Label ToolTip='<%# DataBinder.Eval(Container.DataItem,"SCDLTooltip") %>' runat="server" ID="lblSCDLPropertyName" Text='<%# DataBinder.Eval(Container.DataItem,"SCDLDisplayName") %>' />
<asp:HiddenField runat="server" ID="hdnSCDLPropertyName" Value='<%# DataBinder.Eval(Container.DataItem,"SCDLPropertyName") %>' />
</ItemTemplate>
<ItemStyle Width="100px" CssClass="SCDLHeader" />
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="SCDLPropertyValue" HeaderText="Property Value">
<ItemTemplate>
<asp:Label runat="server" ID="lblSCDLPropertyValue" Text='<%# DataBinder.Eval(Container.DataItem,"SCDLPropertyValue") %>' />
</ItemTemplate>
<ItemStyle Width="100px" CssClass="SCDLHeader"/>
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="SCDLLastModified" HeaderText="Property Last Modified">
<ItemTemplate>
<asp:Label runat="server" ID="lblSCDLPropertyLastModified" Text='<%# DataBinder.Eval(Container.DataItem,"SCDLLastModified") %>' />
</ItemTemplate>
<ItemStyle Width="60px" CssClass="SCDLHeader"/>
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="nsItemDescription" HeaderText="Property Name">
<ItemTemplate>
<asp:Label runat="server" ToolTip='<%# DataBinder.Eval(Container.DataItem,"LOCALDECKTooltip") %>' ID="lblLOCALDECKPropertyName" Text='<%# DataBinder.Eval(Container.DataItem,"defaultcaption") %>' />
<asp:HiddenField runat="server" ID="hdnLocalDeckProprtyName" Value='<%# DataBinder.Eval(Container.DataItem,"nsItemDescription") %>' />
</ItemTemplate>
<ItemStyle Width="100px" CssClass="LocalDeckHeader"/>
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="ID_Value" HeaderText="Property Value">
<ItemTemplate>
<asp:Label runat="server" ID="lblLOCALDECKPropertyValue" Text='<%# DataBinder.Eval(Container.DataItem,"ID_Value") %>' />
</ItemTemplate>
<ItemStyle Width="100px" CssClass="LocalDeckHeader"/>
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="ChangedAt" HeaderText="Property Last Modified">
<ItemTemplate>
<asp:Label runat="server" ID="lblLOCALDECKPropertyLastModified" Text='<%# DataBinder.Eval(Container.DataItem,"ChangedAt") %>' />
</ItemTemplate>
<ItemStyle Width="60px" CssClass="LocalDeckHeader"/>
<HeaderStyle />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderStyle-Width="90px" UniqueName="TemplateColumn"
HeaderText="Action" ItemStyle-CssClass="ActionHeader" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<div class="brdr">
<asp:HiddenField runat="server" ID="hdnItem" Value='<%# DataBinder.Eval(Container.DataItem,"Item") %>' />
<asp:RadioButtonList runat="server" CssClass="brdr" ID="ActionRadioButtonList" RepeatDirection="Vertical">
<asp:ListItem Text="<%$ Resources:Resource, Update%>" Value="U" />
<asp:ListItem Text="<%$ Resources:Resource, Ignore%>" Value="I" Selected="True" />
</asp:RadioButtonList>
</div>
</ItemTemplate>
<FooterTemplate>
<%--<asp:RadioButtonList runat="server" CssClass="footerRadio" ID="ActionRadioButtonList2" RepeatDirection="Horizontal">
<asp:ListItem Text="<%$ Resources:Resource, UpdateAll%>" Value="U" />
<asp:ListItem Text="<%$ Resources:Resource, IgnoreAll%>" Value="I" Selected="True" />
</asp:RadioButtonList>--%>
<asp:Button CommandName="buttonUpdateAll" runat="server" ID="Button1" Text="<%$ Resources:Resource, Update%>"
CssClass="btnAcceptChanges" Width="53px" />
<asp:Button CommandName="buttonIgnnoreAll" runat="server" ID="Button2" Text="<%$ Resources:Resource, Ignore%>"
CssClass="btnAcceptChanges" Width="53px" />
<br />
<asp:Button CommandName="buttonClick" runat="server" ID="btnSubmit" Text="<%$ Resources:Resource, AcceptChanges%>"
CssClass="btnAcceptChanges" />
</FooterTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid><br />
<asp:SqlDataSource ID="SqlDataSource2" SelectCommandType="StoredProcedure" SelectCommand="proc_GetDataForManualComarison"
ConnectionString="<%$ ConnectionStrings:x2common %>" ProviderName="System.Data.SqlClient"
runat="server">
<SelectParameters>
<asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="Item" />
</SelectParameters>
</asp:SqlDataSource>
</telerik:RadPageView>
</telerik:RadMultiPage>
</div>
</asp:Panel>
</NestedViewTemplate>
<Columns>
<telerik:GridBoundColumn SortExpression="ItemIdentifier" HeaderText="<%$ Resources:Resource, SCDLNo%>"
HeaderButtonType="TextButton" DataField="ItemIdentifier" UniqueName="ItemIdentifier">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Supplier" HeaderText="<%$ Resources:Resource, Supplier%>"
HeaderButtonType="TextButton" DataField="Supplier" UniqueName="Supplier">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="ProductGroup" HeaderText="<%$ Resources:Resource, ProductGroup %>"
HeaderButtonType="TextButton" DataField="ProductGroup" UniqueName="ProductGroup">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="ItemLongIdentifier" HeaderText="<%$ Resources:Resource, ProductName %>"
HeaderButtonType="TextButton" DataField="ItemLongIdentifier" UniqueName="ItemLongIdentifier">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="LevelID" HeaderText="Level" HeaderButtonType="TextButton"
DataField="LevelID" UniqueName="LevelID" Display="false">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<PagerStyle Mode="NextPrevAndNumeric" NextPagesToolTip="" PageSizeLabelText='<%$ Resources:Resource, PageSize%>'>
</PagerStyle>
<ItemStyle HorizontalAlign="Left" />
<AlternatingItemStyle HorizontalAlign="Left" />
</telerik:RadGrid>
</td>
</tr>
</table>
</asp:Panel>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
<%--<img alt="Please Wait..." runat="server" src="images/103.gif" style="padding-top:250px;" />--%>
</telerik:RadAjaxLoadingPanel>
<telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1" PageSize="16" Height="500px" > <Fields> <telerik:RadDataPagerSliderField SliderDragText="" SliderOrientation ="Vertical"/> </Fields> </telerik:RadDataPager>
When binding data to the RadComboBox utilizing an Ajax panel, the RadComboBox loses its datasource when used within a master page. The RadComboBox is populated on initial load, but after making a selection, it loses the datasource.
My master page markup:
| <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="Management.Web.Site1" %> |
| <!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> |
| <asp:ContentPlaceHolder ID="head" runat="server"> |
| </asp:ContentPlaceHolder> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> |
| </asp:ContentPlaceHolder> |
| </div> |
| </form> |
| </body> |
| </html> |
My content page markup (WebForm1):
| <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" |
| CodeBehind="WebForm1.aspx.cs" Inherits="Management.Web.WebForm1" %> |
| <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> |
| </asp:Content> |
| <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server" |
| ViewStateMode="Enabled"> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"> |
| <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"> |
| </telerik:RadComboBox> |
| </telerik:RadAjaxPanel> |
| </asp:Content> |
My non-master page markup (WebForm2):
| <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="Management.Web.WebForm2" %> |
| <!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> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"> |
| <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"> |
| </telerik:RadComboBox> |
| </telerik:RadAjaxPanel> |
| </div> |
| </form> |
| </body> |
| </html> |
My code behind (of both the content and non-master pages):
| using System; |
| using System.Web.UI; |
| namespace Management.Web |
| { |
| public partial class WebForm1 : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| if (!Page.IsPostBack) |
| this.LoadTags(); |
| } |
| private void LoadTags() |
| { |
| TagManager mgr = new TagManager(); |
| RadComboBox1.DataSource = mgr.GetAllByModuleId(5); |
| RadComboBox1.DataValueField = "Id"; |
| RadComboBox1.DataTextField = "Name"; |
| RadComboBox1.DataBind(); |
| } |
| protected void RadComboBox1_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) |
| { |
| } |
| } |
| } |
As you can see, the code is VERY basic. The TagManager is a class that returns the data.
When using the Master Page (WebForm1), you lose the datasource after you make your first selection. If you attempt to click on the drop down arrow, after making your initial selection, the RadComboBox is empty (doesn't even respond to the click).
When using the non Master Page (WebForm2), the datasource is persisted no matter how many times you make a selection in the RadComboBox.
Any thoughts why there is a difference when using a master page?
<telerik:RadGrid ID="grdRoles" runat="server" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="false"GridLines="None" Width="375"OnNeedDataSource="GrdRoles_NeedsDataSource"OnDeleteCommand="GrdRoles_DeleteCommand" OnSelectedIndexChanged="GrdRoles_SelectedIndexChanged"> <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="True" Position="Bottom" /> <MasterTableView CommandItemDisplay="None" DataKeyNames="Value" AutoGenerateColumns="False"> <Columns> <telerik:GridBoundColumn DataField="Value" HeaderText="Role" ReadOnly="false" SortExpression="Value" UniqueName="Value"> </telerik:GridBoundColumn> <telerik:GridButtonColumn ConfirmText="Remove all users from this role and delete?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" Visible="true"> <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> </telerik:GridButtonColumn> </Columns> </MasterTableView> <ValidationSettings CommandsToValidate="PerformInsert,Update" /> <ClientSettings enablepostbackonrowclick="true"> <Selecting AllowRowSelect="True" /> </ClientSettings></telerik:RadGrid>| Requested URL | http://www.khabarajel.com:80/Rejected-By-UrlScan?~/Login.aspx?ReturnUrl=%2fadmin%2fTelerik.Web.UI.DialogHandler.aspx%3fDialogName%3dImageManager%26UseRSM%3dtrue%26Skin%3dWindows7%26Title%3dImage%2bManager%26doid%3db3300409-6be9-4187-9f60-581f4c4709b0%26dpptn%3d%26dp%3dFC8qRmpsfkgkAVY%252bbBl5BlAADHUbYgwDE3p%252bNVBcXltpHAtjXWt1KmVcdEYfFUlwHxU%252bT2pqQ0YKdkYOVBZ1LGhnby4gbWtFJVluM1Z2ZGRXExtbWWtQNWNcdEEmdGRECwE%252bbH0IfkccdFE8VxVHB2hlQSklcm9iH2pmLFdISmVQKhdadHd2NWZcA0ALEGtgJQQqXWJ8fnoTXmADVXBXMGh6dy0TbV0AH1lcEGNda0lmKg9sdQF6c2R3dwsVEkVxJC8AXFJ%252bYnckZXgobAZhLmh3cy0iB29nInpYMG5pfF9pExcGdHZtLlN5fF4JAnxEEAoMBGptQHwfZQcqUhZ1LGhhQQIYYkFJHGFDNHh3Qmh9DBNhblgHf34AfF4cHntdJwQEXVRxZl0lXwc%252begdhO1ZlbDYMdk4EEmVyd2JpcENRdgddal5bNWtnfEIgK2REFC8ARlMLYUILYUU9ewVidn92eHIXcm9AHGp%252bM1VIB3VSEwdFWgFTA2tmaEInK10HJxV%252fQHxSZkEfZUoybHBhd1F1bwoYYghfCnduK1Z5fFx%252fAABFblhTEVIAQmsWKHNfIxYQbGdVUHsiZGgSV3JlEWQDczIbcFoGI2dMMWFfcGpldykEb1l1CVVceEcQKF1eCywuA2R%252bQEIidF4cbAZLF2QCY3QWY11YJHV6MWFfcGpldykEb11bdWsAaHoTKH9WEQc2QmlhXwARdEIcZRllFWRlTT8SYGNSJHV6NmBfcFl%252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