
- I have two user controls that each contains a DetailsView with a dropdownlist as a template field in the DetailsView
o The dropdown triggers a postback which raises an event that the page then uses to determine which user control to load depending on the value selected in the dropdown.
- I load one of the two different user controls onto the page depending on the value of the selected item in the dropdownlist.
o This seems to be working correctly as the correct user control loads depending on which value is selected in the dropdownlist within the user control
- Problem: However, after loading a different usercontrol/DetailsView the selected item of the drop down list is not retained (E.g. even though the correct user control/details view loaded the dropdownlist is not remembering the previously selected value). So while the correct user control loads the selected value in the dropdown is not retained.
Any help would be appreciated.
| <%@ Control Language="VB" AutoEventWireup="false" CodeFile="ItemBuilderSimpleItem.ascx.vb" Inherits="admin_UserControls_App_ItemBuilderSimpleItem" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" |
| DataKeyNames="ItemID" DataSourceID="SqlDataSource1" BorderWidth="0" CellPadding="0" CellSpacing="7"> |
| <Fields> |
| <asp:TemplateField HeaderText="<%$Resources: Config, ItemType %>" SortExpression="ItemTypeID"> |
| <EditItemTemplate> |
| <telerik:RadComboBox ID="cboItemTypesDropdown" OnSelectedIndexChanged="ItemType_SelectedIndexChanged" runat="server" DataSourceID="SqlDataSource2" |
| DataTextField="Alias" |
| DataValueField="ItemTypeID" |
| SelectedValue='<%#Bind("ItemTypeID") %>' AutoPostBack="true" Width="350px"> |
| </telerik:RadComboBox> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label Runat="server" Text='<%# Bind("ItemTypeID") %>' ID="lblItemTypeID"></asp:Label> |
| </ItemTemplate> |
| </asp:TemplateField> |
| <asp:BoundField DataField="Alias" HeaderText="<%$Resources: Config, Alias %>" SortExpression="Alias" ControlStyle-Width="350px" /> |
| <asp:CheckBoxField DataField="IsActive" HeaderText="<%$Resources: Config, IsActive %>" SortExpression="IsActive" /> |
| <asp:CommandField ShowEditButton="True" EditText="<%$Resources: Config, Update %>"/> |
| <asp:CommandField ShowInsertButton="True" InsertText="<%$Resources: Config, Add %>"/> |
| <asp:CommandField ShowDeleteButton="True" DeleteText="<%$Resources: Config, Delete %>" /> |
| </Fields> |
| </asp:DetailsView> |
| <br /> |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connApp_PRD %>" DeleteCommand="proc_ConfigItems_Delete" DeleteCommandType="StoredProcedure" InsertCommand="proc_ConfigItems_Add" InsertCommandType="StoredProcedure" SelectCommand="proc_ConfigItems_GetItemByItemID" SelectCommandType="StoredProcedure" UpdateCommand="proc_ConfigItems_Update" UpdateCommandType="StoredProcedure"> |
| <DeleteParameters> |
| <asp:Parameter Name="ItemID" Type="Int64" /> |
| </DeleteParameters> |
| <UpdateParameters> |
| <asp:Parameter Name="ItemID" Type="Int64" /> |
| <asp:Parameter Name="ItemTypeID" Type="Int64" /> |
| <asp:Parameter Name="Alias" Type="String" /> |
| <asp:Parameter Name="IsActive" Type="Boolean" /> |
| </UpdateParameters> |
| <InsertParameters> |
| <asp:Parameter Name="ItemTypeID" Type="Int64" /> |
| <asp:Parameter Name="Alias" Type="String" /> |
| <asp:Parameter Name="IsActive" Type="Boolean" /> |
| </InsertParameters> |
| <SelectParameters> |
| <asp:QueryStringParameter Name="ItemID" QueryStringField="ItemID" Type="Int64" /> |
| </SelectParameters> |
| </asp:SqlDataSource> |
| <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:connApp_PRD %>" |
| SelectCommand="proc_ItemTypes_GetAllItemTypes" SelectCommandType="StoredProcedure"> |
| </asp:SqlDataSource> |
| Imports System |
| Imports System.Data |
| Imports System.Collections |
| Imports System.Web.UI |
| Imports Telerik.Web.UI |
| Imports Microsoft.ApplicationBlocks.Data |
| Imports System.Configuration |
| Imports System.Data.SqlClient |
| Imports JG.App.Core |
| Partial Class admin_UserControls_App_ItemBuilderSimpleItem |
| Inherits System.Web.UI.UserControl |
| Implements IItemBuilder |
| Private _ItemType As Integer |
| 'Moved delegate to interface definition |
| 'Public Delegate Sub ItemTypeChangedHandler(ByVal sender As Object, ByVal e As ItemTypeChangedEventArgs) |
| Public Event ItemTypeChanged(ByVal sender As Object, ByVal e As ItemTypeChangedEventArgs) Implements IItemBuilder.ItemTypeChanged |
| Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init |
| If Page.Request.QueryString("ItemID") Is Nothing Then |
| DetailsView1.DefaultMode = DetailsViewMode.Insert |
| Else |
| DetailsView1.DefaultMode = DetailsViewMode.Edit |
| End If |
| End Sub |
| 'Add a method that resembles default methods to handle the Item type changing |
| Protected Sub ItemType_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) |
| Dim control As RadComboBox = ControlUtility.Instance.FindControlRecursive("cboItemTypesDropdown") |
| If Not IsNothing(control) Then |
| ItemType = control.SelectedValue |
| End If |
| End Sub |
| Public Property ItemType() As Integer Implements IItemBuilder.ItemType |
| Get |
| Dim control As RadComboBox = ControlUtility.Instance.FindControlRecursive("cboItemTypesDropdown") |
| If Not IsNothing(control) Then |
| If control.SelectedItem.Value = String.Empty Then |
| control.SelectedIndex = -1 |
| _ItemType = Nothing |
| MsgBox("Nothing") |
| Else |
| _ItemType = control.SelectedItem.Value |
| MsgBox("2 selected item: " & _ItemType.ToString) |
| End If |
| MsgBox("3 selected item: " & _ItemType.ToString) |
| Return _ItemType |
| End If |
| End Get |
| Set(ByVal Value As Integer) |
| Dim control As RadComboBox = ControlUtility.Instance.FindControlRecursive("cboItemTypesDropdown") |
| If Not IsNothing(control) Then |
| If Not IsNothing(control.Items.FindItemByValue(Value)) Then |
| control.Items.FindItemByValue(Value).Selected = True |
| _ItemType = Value |
| MsgBox("Do I ever get here?" & _ItemType) |
| OnItemTypeChanged() |
| End If |
| End If |
| End Set |
| End Property |
| Protected Sub OnItemTypeChanged() |
| RaiseEvent ItemTypeChanged(Me, New ItemTypeChangedEventArgs(_ItemType)) |
| End Sub |
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
| Dim control As RadComboBox = ControlUtility.Instance.FindControlRecursive("cboItemTypesDropdown") |
| If Not IsNothing(control) Then |
| If Not IsNothing(control.Items.FindItemByValue(ItemType)) Then |
| control.Items.FindItemByValue(ItemType).Selected = True |
| End If |
| End If |
| End Sub |
| End Class |

Can anyone please indicate how I can hide the id columns?
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" OnColumnCreated="RadGrid1_ColumnCreated"
OnItemCreated="RadGrid1_ItemCreated" OnItemDataBound="RadGrid1_ItemDataBound"
Skin="Sunset" >
<MasterTableView HierarchyDefaultExpanded="false" HierarchyLoadMode="Client" AllowSorting="true"
DataKeyNames="id, parentid" Width="100%" FilterExpression="id=1">
<SelfHierarchySettings ParentKeyName="parentid" KeyName="id" />
<Columns>
<telerik:GridTemplateColumn UniqueName="TemplateEditColumn">
<ItemTemplate>
<asp:HyperLink ID="EditLink" runat="server" Text="Edit"></asp:HyperLink>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings AllowExpandCollapse="true">
</ClientSettings>
</telerik:RadGrid>
| <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" |
| CodeBehind="Tolerance.aspx.cs" Inherits="GainLossSettlement.Tolerance" StylesheetTheme="Default" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> |
| </asp:Content> |
| <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> |
| <h2> |
| <span>Tolerance Percentage By Terminal / Product / Supplier</span></h2> |
| <telerik:RadScriptBlock runat="server"> |
| <script type="text/javascript"> |
| function showBottem() { |
| document.getElementById('divContainer').style.visibility = ''; |
| } |
| function hideBottem() { |
| var item = document.getElementById('divContainer'); |
| item.style.visibility = 'hidden'; |
| } |
| </script> |
| </telerik:RadScriptBlock> |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="rcbTerminals"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="rcbProducts" LoadingPanelID="radLoadingProducts" /> |
| <telerik:AjaxUpdatedControl ControlID="rcbSuppliers" LoadingPanelID="RadLoadingSupplier" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="rcbProducts"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="rcbSuppliers" LoadingPanelID="RadLoadingSupplier" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
| <br /> |
| <div class="clear"> |
| </div> |
| <label class="controlLabel"> |
| Terminal<span class="small">Select Terminal</span></label> |
| <telerik:RadComboBox ID="rcbTerminals" runat="server" Skin="WebBlue" LoadingMessage="Loading..." |
| MarkFirstMatch="true" EnableLoadOnDemand="true" AutoPostBack="True" OnSelectedIndexChanged="rcbTerminals_SelectedIndexChanged" |
| Width="17em" CssClass="radControl"> |
| </telerik:RadComboBox> |
| <div class="clear"> |
| </div> |
| <label class="controlLabel"> |
| Product<span class="small">Select Product</span></label> |
| <telerik:RadComboBox ID="rcbProducts" runat="server" Skin="WebBlue" LoadingMessage="Loading..." |
| MarkFirstMatch="true" EnableLoadOnDemand="true" Width="17em" CssClass="controlLabel" |
| AutoPostBack="True" OnSelectedIndexChanged="rcbProducts_SelectedIndexChanged"> |
| </telerik:RadComboBox> |
| <telerik:RadAjaxLoadingPanel ID="radLoadingProducts" runat="server" IsSticky="True" |
| MinDisplayTime="1000" CssClass="small"> |
| <asp:Image ID="loading" runat="server" ImageUrl="~/App_Themes/Default/Images/Web20.gif" |
| Height="18px" Width="18px" />Loading... |
| </telerik:RadAjaxLoadingPanel> |
| <div class="clear"> |
| </div> |
| <label class="controlLabel"> |
| Supplier<span class="small">Select Supplier</span></label> |
| <telerik:RadComboBox ID="rcbSuppliers" runat="server" Skin="WebBlue" |
| MarkFirstMatch="true" Width="17em" CssClass="controlLabel" |
| AutoPostBack="True" OnSelectedIndexChanged="rcbSuppliers_SelectedIndexChanged"> |
| </telerik:RadComboBox> |
| <telerik:RadAjaxLoadingPanel ID="RadLoadingSupplier" runat="server" IsSticky="True" |
| MinDisplayTime="1000" CssClass="small"> |
| <asp:Image ID="Image1" runat="server" ImageUrl="~/App_Themes/Default/Images/Web20.gif" |
| Height="18px" Width="18px" />Loading... |
| </telerik:RadAjaxLoadingPanel> |
| <br /> |
| <div class="clear"> |
| </div> |
| <br /> |
| <div id="divContainer" class="divContainer"> |
| <fieldset> |
| <legend title="Tolerance Rate">Current Tolerance Rate</legend> |
| <div class="divPaddedContainer"> |
| <label class="controlLabel"> |
| Rate:</label><asp:Label ID="lblCurrentRate" runat="server"></asp:Label> |
| <asp:Label ID="lblIsDefault" runat="server" Text="*"></asp:Label> |
| <div class="clear"> |
| </div> |
| <label class="controlLabel"> |
| Effective As Of:</label><asp:Label ID="lblEffectiveDate" runat="server"></asp:Label><div |
| class="clear"> |
| </div> |
| </div> |
| </fieldset> |
| <br /> |
| <br /> |
| <fieldset> |
| <legend title="New Tolerance Rate">New Tolerance Rate</legend> |
| <div class="divPaddedContainer"> |
| <label class="controlLabel"> |
| Rate:</label> |
| <telerik:RadNumericTextBox ID="rtbNewRate" runat="server" Width="8em" Skin="WebBlue"> |
| <NumberFormat DecimalDigits="4" GroupSeparator="" /> |
| </telerik:RadNumericTextBox> |
| <asp:CheckBox ID="cbNewDefault" runat="server" Text="Use Default Rate"></asp:CheckBox> |
| <div class="clear"> |
| </div> |
| <label class="controlLabel"> |
| Effective Date: |
| </label> |
| <telerik:RadDatePicker ID="rdpNewEffectiveDate" runat="server" Skin="Web20" Width="8em"> |
| <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x" |
| Skin="Web20"> |
| </Calendar> |
| <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton> |
| </telerik:RadDatePicker> |
| <div class="clear"> |
| </div> |
| </div> |
| </fieldset> |
| <br /> |
| <br /> |
| <span>*</span><span class="smallInline"> Default Tolerance</span> |
| </div> |
| <div class="clear"> |
| </div> |
| </asp:Content> |
Ok.. after reading the documentation on binding ado.net data service every example seems reflect everything im doing but its still not working. Here is what i have
Service.svc code
| Public Shared Sub InitializeService(ByVal config As IDataServiceConfiguration) |
| config.SetEntitySetAccessRule("*", EntitySetRights.AllRead) |
| config.SetServiceOperationAccessRule("*", ServiceOperationRights.All) |
| End Sub |
| <WebGet()> _ |
| Public Function GetSessions() As IQueryable(Of Session) |
| Return (From Sessions In Me.CurrentDataSource.Session _ |
| Select Sessions) |
| End Function |
| <WebGet()> _ |
| Public Function GetCount(ByVal where As String) As Integer |
| Return If([String].IsNullOrEmpty(where), CurrentDataSource.Session.Count(), CurrentDataSource.Session.Where(where).Count()) |
| End Function |
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> |
| <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> |
| <%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %> |
| <!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> |
| </div> |
| <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"> |
| <telerik:RadGrid ID="RadGrid1" runat="server" |
| GridLines="None" AutoGenerateColumns="False"> |
| <MasterTableView> |
| </MasterTableView> |
| <ClientSettings> |
| <DataBinding Location="http://localhost:1687/BCSS.svc/" |
| SelectMethod="GetSessions" |
| SelectCountMethod="GetCount" > |
| <DataService TableName="Session" /> |
| </DataBinding> |
| </ClientSettings> |
| </telerik:RadGrid> |
| </telerik:RadAjaxPanel> |
| </form> |
| </body> |
| </html> |
| Dim WS As New BCSSEntities(New Uri("http://localhost:1687/BCSS.svc/", UriKind.Absolute)) |
| Dim query = From Session In WS.Session _ |
| Select Session |
| Me.RadGrid1.DataSource = query |
| Me.RadGrid1.DataBind() |
We are creating an asp.net webpart that is integrated into a Sharepoint site.
The webpart contains an asp:Panel that contains a RadChart control.
This RadChart control can be edited through the Web part configuration settings.
However, if we add the radchart to a RadAjaxPanel,and add this RadAjaxPanel to the webpart controls, and edit the webpart, the webpart doesnot change on first click of Apply button in Web Part Configuration.
The Webpart is refreshed on the second click of Apply button.
This is happening because the sequence of function calls of the EditorPart and Webpart is changing on adding a RadAjaxPanel.
Can you please help asap.
Wih Regards,
Shikha
I am have RadAjaxManager with more than 40 entries in it with settings to update target controls based on some source control. Just standard need why we need it.
Issue is for some of the events, the RadAjaxManger seems to update/refresh either the whole page or controls that are not supposed to be refreshed.
E.g. following is just excerpt of it. When an event occurs in 'trvRegions', I do not want to update controls ucFilterList or ucVolumeList. But still for trvRegions events, AjaxManager updates these two controls. When such behavior occurs, what is the best way to solve it? Do I have to have each control inside a PANEL or I can directly mention the user controls? How do I find out actually which controls the AjaxManager is going to update (if it is updating more than what I have set?)
Thanks,
Piyush Bhatt.
<
telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true">
<telerik:AjaxSetting AjaxControlID="trvRegions">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ucQueryFieldSelector"/>
<telerik:AjaxUpdatedControl ControlID="rcomboFilterFields"/>
<telerik:AjaxUpdatedControl ControlID="ucFieldList"/>
<telerik:AjaxUpdatedControl ControlID="ucQueryVolumeSelector"/>
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="ucQueryVolumeSelector" EventName="VolumeSelectionChanged">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ucVolumeList"/>
</UpdatedControls>
</telerik:AjaxSetting>
...........
</telerik:RadAjaxManager