Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
102 views

Hi, I have one telerik rad grid.Using a method i am filling the grid.I have enabled paging property.I have used itemtemplate-->ImageButton for delete and edit options.I have set page size as 10.Page load time it is working properly and populating the grid.After inserting 11 th row the pagination starts and it will show in next page with one record.But when i am deleting the 11th row the grid become blank.I have used dataset to bind the records. radgrid.DataBind(); dsDataset.Dispose();. But its item.count is 0. What is the reason?

protected void Page_Load(object sender, EventArgs e)
   
{
       
try
       
{
           
if (!IsPostBack)
           
{
               
PopulatePackage();
           
}
       
}
       
catch (Exception ex)
       
{
            lblMessage
.Text = objUtl.GetErrorMessage(ex, this);
            lblMessage
.Visible = true;


protected void gvPackage_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
   
{
       
try
       
{
           
SqlHelper objSQL = new SqlHelper();
           
DataSet dsPackage = new DataSet();
            dsPackage
= objSQL.ExecuteDataset("AL_PackageType_List_Retrieve",
                                             objUtl
.NumericEntry(Session["LocationId"].ToString()));
            gvPackage
.DataSource = dsPackage.Tables[0];
            dsPackage
.Dispose();
           
//PopulatePackage();
       
}
       
catch (Exception ex)
       
{
            lblMessage
.Text = objUtl.GetErrorMessage(ex, this);
            lblMessage
.Visible = true;
       
}
   
}





private void PopulatePackage()
   
{
       
try
       
{
            lblMessage
.Text = string.Empty;
           
SqlHelper objSQL = new SqlHelper();
           
DataSet dsPackage = new DataSet();
            dsPackage
= objSQL.ExecuteDataset("AL_PackageType_List_Retrieve",
                                             objUtl
.NumericEntry(Session["LocationId"].ToString()));
            gvPackage
.DataSource = null;
            gvPackage
.DataSource = dsPackage.Tables[0];
            gvPackage
.DataBind();
           
//dsPackage.Dispose();
           
if (gvPackage.Items.Count <= 0)
           
{
                lblMessage
.Text = "No Package Details Found...";
                gvPackage
.Visible = false;
           
}
           
else
           
{
                gvPackage
.Visible = true;
           
}
       
}
       
catch (Exception ex)
       
{
            lblMessage
.Text = objUtl.GetErrorMessage(ex, this);
            lblMessage
.Visible = true;
       
}
   
}
Tsvetina
Telerik team
 answered on 18 Nov 2010
1 answer
163 views
this control is kewl!

We are planning to use this, before that, have few questions....please help me

1) Can we have custom headers & footer?
2) Column freezing?
3) Do we have different kind of binding modes like we do with RadGrid?
4) is there any differnce between beith WEB & WPF control in the functionality wise?

Thanks,
1) can we have custom headers & footers?
2) column freezing?
3) do we have different kind of data bindings like we do in case of RadGrid?
4) is there any difference between WEB & WPF control in the functionality wise?
5) can we have a feature comparison report between RadGrid & Treelist?

Thanks,
Suman
Veli
Telerik team
 answered on 18 Nov 2010
2 answers
485 views

I have a RadListBox showing selected filter rules. I can add items to this ListBox by transferring from other ListBoxes or by creating from other controls' data using client-side javascript. When I add or remove items, I update RadGrid asynchronously using RadAjaxManager. In javascript always when I add or remove items to the ListBox, I call a function to make RadAjaxManager to update RadGrid.


When I add new items, the items appear in the ListBox client-side and also server-side. But when I remove items, it removes the item client-side and calls the AjaxManager request, but the items are not removed from the server side collection. For example if I add and remove the exactly same item 5 times, then I would have 0 items shown in the client-side ListBox but the same item 5 times in the server-side collection.

 

I am using trackChanges() and commitChanges() functions both when adding or deleting items. The ListBox is not posted back. Why is it so that adding items using these functions works but removing doesn’t?

 

Thanks,

Simo

 


Here are the functions to add and delete the items and call the Ajax manager (alerts for testing purposes):

 

function StateListBoxItemDblClicked() {
     alert("StateListBoxItemDblClicked " + ListboxDestination.get_items().get_count());
     var listBoxSource = $find("<%= UseCaseStateRadListBox.ClientID %>");
     listboxDestination.trackChanges();
     var item = listBoxSource.get_selectedItem();
     listBoxSource.transferToDestination(item);
     listboxDestination.commitChanges();
     UseCaseRadGridRebind();
 }
  
 function DeleteSelectedItemFromDestination() {
     listboxDestination.trackChanges();
     var item = listboxDestination.get_selectedItem();
     listboxDestination.get_items().remove(item);                
     listboxDestination.commitChanges();
     alert("Deleted "+ listboxDestination.get_items().get_count());
     UseCaseRadGridRebind();
 }
  
function UseCaseRadGridRebind() {
    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("UseCaseRadGridRebind");
}

 

Here is the RadAjaxManager, RadGrid inside RadPane and RadListBox inside RadPanelBar.

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
    onajaxrequest="RadAjaxManager1_AjaxRequest" EnableViewState="False">
    <AjaxSettings>
         <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="UseCaseRadGrid" LoadingPanelID="LoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
  
  
        <telerik:RadPane runat="server">
            <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" Skin="Default">
     </telerik:RadAjaxLoadingPanel>
        <telerik:RadGrid ID="UseCaseRadGrid" runat="server" AutoGenerateColumns="False"
                GridLines="None" Width="440" Visible="true"
                onselectedindexchanged="UseCaseRadGrid_SelectedIndexChanged"
                onitemcommand="UseCaseRadGrid_ItemCommand"
                    onneeddatasource="UseCaseRadGrid_NeedDataSource" >
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="true" />
</ClientSettings>
       <MasterTableView AutoGenerateColumns="False" ShowHeadersWhenNoRecords="True" EnableNoRecordsTemplate="true">
        <Columns>
            ...
        </Columns>
       </MasterTableView>
        </telerik:RadGrid>
        </telerik:RadPane>
  
  
<telerik:RadPanelItem Text="Valitut hakuehdot">
<ContentTemplate>
    <telerik:RadListBox runat="server" ID="RadListBoxDestination" AutoPostBackOnDelete="false"
        Height="200px" Width="500px" AllowAutomaticUpdates="false" OnClientDeleted="DeleteSelectedItemFromDestination"
AllowDelete="True" SelectionMode="Multiple" AllowReorder="False" OnClientItemDoubleClicked="DeleteSelectedItemFromDestination"  />
 </ContentTemplate>
</telerik:RadPanelItem>
</Items>
</telerik:RadPanelBar>


        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument == "UseCaseRadGridRebind")
                UseCaseRadGrid.Rebind();
        }
  
RadListBoxItemCollection RadListBoxDestinationItems = RadListBoxDestination.Items;
Simo
Top achievements
Rank 1
 answered on 18 Nov 2010
4 answers
105 views
Hi All,
The HTML rendered out by the radgrid HTMLEditorColumn is NOT the same as that render in the Editor proper. It seems there are a few discrepencies which point to an old renderer being used.
In the HTMLEditorColumn
Line breaks rendered as <BR>
Changes in fonts are rendered as <font ...> font blocks
In the Editor proper
Line breaks rendered as <br />
Changes in fonts are rendered as <span style='font...> span blocks.

Is there a reason for this?  I am having a lot of trouble getting consistency in my rendering layouts because of this. Not to mention having to implement work-arounds to get XHTML compliance for exporting to PDF.
Before I get involved in changing my framework to use and Editor in a templated column, I would like to know if this is a bug or something that is expected.

Thanks,
Steele.
Dobromir
Telerik team
 answered on 18 Nov 2010
1 answer
366 views
Hi,

I am creating Radmenu and Radwindow dynamically in the page_load, i want to open the radwindow(dynamically created) on Rad Menu "OnClientItemClicked". When i do this i am getting "Microsoft JScript runtime error: Sys.InvalidOperationException: Two components with the same id 'RadWindow2' can't be added to the application." exception.
I am using Telerik Version=2010.2.929.20. In the view source of the page i dont see 2 Radwindows. I have only one Radwindow with ID'RadWindow2".

thanks,
srikanth

Shinu
Top achievements
Rank 2
 answered on 18 Nov 2010
1 answer
103 views
Hi all,

We are using Telerik Scheduler trial in one of our projects to test its abilities. Since the specification prompts to have a resources on the horizontal axis and time on the vertical axis we came across a problem. The number of resources is dynamic and we cannot predict how many resources (employees) the user will have. The scheduler could grow horizontally and look bad, have horizontal scroll and low usability. Our designers come with an idea to have a functionality like expand and shrink of a scheduler column. So, I was wondering if such functionality can be accomplished using your scheduler so we can interpret resources (columns) shrink and then allow users to expand them on demand.

I would appreciate your answer.

Thank you.
Nikolay Tsenkov
Telerik team
 answered on 18 Nov 2010
7 answers
244 views
Hi!

I have a self-referencing grid with custom CRUD operations (NeedDataSource and custom OnItemCommand events). It is made after this demo http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/selfreferencing/defaultcs.aspx and this article http://www.telerik.com/help/aspnet-ajax/grdselfreferencinghierarchy.html.

When i set the HierarchyDefaultExpanded to true, everything works fine, but I have a lot of data in my grid so I would like to collapse everything at the start. So, when I set the HierarchyDefaultExpanded to false, the grid is initially collapsed, but the edit form doesn't show on child items. The edit work only on the top level of the hierarchy.

This is my grid
<telerik:RadGrid ID="RG_MENU_MenuItem" runat="server"
                     DataSourceID="ods_MENU_MenuItem"
                     AutoGenerateColumns="false"
                     AllowSorting="false"
                     OnNeedDataSource="RG_MENU_MenuItem_NeedDataSource"
                     OnColumnCreated="RG_MENU_MenuItem_ColumnCreated"
                     OnItemDataBound="RG_MENU_MenuItem_ItemDataBound"
                     OnItemCreated="RG_MENU_MenuItem_ItemCreated"
                     OnItemCommand="RG_MENU_MenuItem_ItemCommand"
                     OnInsertCommand="RG_MENU_MenuItem_InsertCommand"
                     OnUpdateCommand="RG_MENU_MenuItem_UpdateCommand"
                     OnDeleteCommand="RG_MENU_MenuItem_DeleteCommand">
        <MasterTableView HierarchyDefaultExpanded="true"
                         HierarchyLoadMode="Client"
                         AllowSorting="false"
                         EditMode="PopUp"
                         DataKeyNames="MenuItemID, ParentItemID"
                         Width="100%">
            <SelfHierarchySettings ParentKeyName="ParentItemID" KeyName="MenuItemID" />
            <Columns>      
                <telerik:GridBoundColumn DataField="MenuItemID"
                                         HeaderText="ID"
                                         SortExpression="MenuItemID"
                                         UniqueName="MenuItemID"
                                         DataType="System.Int64"
                                         AllowFiltering="false"
                                         ReadOnly="true">
                    <HeaderStyle CssClass="rgHeader column0"/>
                    <ItemStyle CssClass="column0" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="AppDescription"
                                         HeaderText="App Description"
                                         SortExpression="AppDescription"
                                         UniqueName="AppDescription"
                                         CurrentFilterFunction="Contains"
                                         AutoPostBackOnFilter="true">
                    <HeaderStyle CssClass="rgHeader column1"/>
                    <ItemStyle CssClass="column1" />
                </telerik:GridBoundColumn>              
                <telerik:GridTemplateColumn DataField="MenuInstanceID"
                                            HeaderText="Menu Instance"
                                            SortExpression="MenuInstanceID"
                                            UniqueName="MenuInstanceID">
                                            <FilterTemplate>
                                                <telerik:RadComboBox ID="rcbMenuInstanceFilter" runat="server"
                                                                     DataSourceID="ods_MenuInstance"
                                                                     DataTextField="AppDescription"
                                                                     DataValueField="MenuInstanceID"
                                                                     AllowCustomText="true"
                                                                     AppendDataBoundItems="true"
                                                                     Width="100"
                                                                     SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("MenuInstanceID").CurrentFilterValue %>'
                                                                     OnClientSelectedIndexChanged="rcbMenuInstanceFilter_SelectedIndexChanged">
                                                    <Items>
                                                        <telerik:RadComboBoxItem Text="" Value="" />
                                                    </Items>
                                                </telerik:RadComboBox>
                                                <telerik:RadScriptBlock ID="rsbMenuInstanceFilter" runat="server">
                                                    <script type="text/javascript">
                                                        function rcbMenuInstanceFilter_SelectedIndexChanged(sender, args) {
                                                            var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                                            tableView.filter("MenuInstanceID", args.get_item().get_value(), "EqualTo");
                                                        }
                                                    </script>
                                                </telerik:RadScriptBlock>
                                            </FilterTemplate>
                                            <ItemTemplate>
                                                <%# Eval("MenuInstance.AppDescription")%>
                                            </ItemTemplate>
                    <HeaderStyle CssClass="rgHeader column2"/>
                    <ItemStyle CssClass="column2" />
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="PageID"
                                            HeaderText="Page"
                                            SortExpression="PageID"
                                            UniqueName="PageID">
                                            <FilterTemplate>
                                                <telerik:RadComboBox ID="rcbPageFilter" runat="server"
                                                                     DataSourceID="ods_Page"
                                                                     DataTextField="AppDescription"
                                                                     DataValueField="PageID"
                                                                     AllowCustomText="true"
                                                                     AppendDataBoundItems="true"
                                                                     Width="100"
                                                                     SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("PageID").CurrentFilterValue %>'
                                                                     OnClientSelectedIndexChanged="rcbPageFilter_SelectedIndexChanged">
                                                    <Items>
                                                        <telerik:RadComboBoxItem Text="" Value="" />
                                                    </Items>
                                                </telerik:RadComboBox>
                                                <telerik:RadScriptBlock ID="rsbPageFilter" runat="server">
                                                    <script type="text/javascript">
                                                        function rcbPageFilter_SelectedIndexChanged(sender, args) {
                                                            var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                                            tableView.filter("PageID", args.get_item().get_value(), "EqualTo");
                                                        }
                                                    </script>
                                                </telerik:RadScriptBlock>
                                            </FilterTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Page.AppDescription")%>
                                            </ItemTemplate>
                    <HeaderStyle CssClass="rgHeader column3"/>
                    <ItemStyle CssClass="column3" />
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="WebOrder"
                                         HeaderText="Web Order"
                                         SortExpression="WebOrder"
                                         UniqueName="WebOrder"
                                         DataType="System.Int32"
                                         FilterControlWidth="25px">
                    <HeaderStyle CssClass="rgHeader column5"/>
                    <ItemStyle CssClass="column5" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="IsActive"
                                         HeaderText="Is Active"
                                         SortExpression="IsActive"
                                         UniqueName="IsActive"
                                         DataType="System.Boolean">
                    <HeaderStyle CssClass="rgHeader column6"/>
                    <ItemStyle CssClass="column6" />
                </telerik:GridBoundColumn>         
                <telerik:GridBoundColumn DataField="TimeStamp"
                                         DataType="System.DateTime"
                                         HeaderText="Time Stamp"
                                         SortExpression="TimeStamp"
                                         UniqueName="TimeStamp"
                                         AllowFiltering="false">
                    <HeaderStyle CssClass="rgHeader column10"/>
                    <ItemStyle CssClass="column10" />
                </telerik:GridBoundColumn>
                <telerik:GridButtonColumn CommandName="CustomEdit"
                                          ButtonType="ImageButton"
                                          UniqueName="EditColumn"
                                          ImageUrl="~/_Med_App/images/edit.gif">
                    <HeaderStyle CssClass="rgHeader column11"/>
                    <ItemStyle CssClass="column11" />
                </telerik:GridButtonColumn>
                <telerik:GridButtonColumn ConfirmText="Jeste li sigurni da želite obrisati odabranu stavku?"
                                          CommandName="Delete"
                                          ButtonType="ImageButton"
                                          UniqueName="DeleteColumn">
                    <HeaderStyle CssClass="rgHeader column12"/>
                    <ItemStyle CssClass="column12" />
                </telerik:GridButtonColumn>
                <telerik:GridTemplateColumn UniqueName="SelectColumn"
                                            AllowFiltering="true"
                                            Display="false">
                                            <FilterTemplate>
                                                <asp:CheckBox ID="cbxSelectAllForSync" runat="server" AutoPostBack="true"
                                                              OnCheckedChanged="SelectAll_CheckedChanged" />                                               
                                            </FilterTemplate>
                                            <ItemTemplate>
                                                <asp:CheckBox ID="cbxSelectForSync" runat="server" />
                                            </ItemTemplate>
                    <HeaderStyle CssClass="rgHeader column13"/>
                    <ItemStyle CssClass="column13" />
                </telerik:GridTemplateColumn>
            </Columns>
            <EditFormSettings EditFormType="Template">
                <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
                <FormTemplate>
                    <table class="edit-table-rad" cellspacing="2" cellpadding="1" width="100%" border="0">
                        <tr>
                            <td align="left" width="200px">
                                <b>MenuItemID:</b>
                            </td>
                            <td>
                                <%# Eval("MenuItemID").ToString()%>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="200px">
                                <b>ParentItem:</b>
                            </td>
                            <td width="350px">
                                <telerik:RadComboBox ID="rcbParentItemID" runat="server"
                                                     DataSourceID="ods_MENU_ParentMenuItem"
                                                     DataTextField="AppDescription"
                                                     DataValueField="MenuItemID"
                                                     AppendDataBoundItems="true"
                                                     AllowCustomText="true"
                                                     Filter="StartsWith"
                                                     Width="350px">
                                    <Items>
                                        <telerik:RadComboBoxItem Text="" Value="" />
                                    </Items>
                                </telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="200px">
                                <b>Menu Instance:</b>
                            </td>
                            <td width="350px">
                                <telerik:RadComboBox ID="rcbMenuInstanceID" runat="server"
                                                     DataSourceID="ods_MenuInstance"
                                                     DataTextField="AppDescription"
                                                     DataValueField="MenuInstanceID"
                                                     AllowCustomText="true"
                                                     Width="350px">
                                </telerik:RadComboBox>
                            </td>
                            <td>
                                <asp:RequiredFieldValidator ID="rfvMenuInstanceID" runat="server"
                                                            ControlToValidate="rcbMenuInstanceID"
                                                            ErrorMessage="Obavezan unos!"
                                                            ForeColor="Red">
                                </asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="200px">
                                <b>Page:</b>
                            </td>
                            <td width="350px">
                                <telerik:RadComboBox ID="rcbPageID" runat="server"
                                                     DataSourceID="ods_Page"
                                                     DataTextField="AppDescription"
                                                     DataValueField="PageID"
                                                     AppendDataBoundItems="True"
                                                     AllowCustomText="true"
                                                     Width="350px">
                                    <Items>
                                        <telerik:RadComboBoxItem Text="" Value="" />
                                    </Items>
                                </telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="200px">
                                <b>Menu Item Url:</b>
                            </td>
                            <td width="350px">
                                <telerik:RadTextBox ID="txtMenuItemUrl" runat="server" Width="350px"/>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="200px">
                                <b>App Description:</b>
                            </td>
                            <td width="350px">
                                <telerik:RadTextBox ID="txtAppDescription" runat="server" Width="350px"/>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="200px">
                                <b>Web Order:</b>
                            </td>
                            <td width="350px">
                                <telerik:RadNumericTextBox ID="rnbWebOrder" runat="server" NumberFormat-DecimalDigits="0" Width="350px"/>
                            </td>
                            <td>
                                <asp:RequiredFieldValidator ID="rfvWebOrder" runat="server"
                                                            ControlToValidate="rnbWebOrder"
                                                            ErrorMessage="Obavezan unos!"
                                                            ForeColor="Red">
                                </asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="200px">
                                <b>Is Active:</b>
                            </td>
                            <td width="350px">
                                <asp:CheckBox ID="chbIsActive" runat="server" Checked="false"/>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="200px">
                                <b>Priority Factor:</b>
                            </td>
                            <td width="350px">
                                <telerik:RadNumericTextBox ID="rnbPriorityFactor" runat="server" NumberFormat-DecimalDigits="0" Width="350px"/>
                            </td>
                            <td>
                                <asp:RequiredFieldValidator ID="rfvPriorityFactor" runat="server"
                                                            ControlToValidate="rnbPriorityFactor"
                                                            ErrorMessage="Obavezan unos!"
                                                            ForeColor="Red">
                                </asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Button ID="InsertUpdateButton" runat="server" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button>
                                <asp:Button ID="CancelButton" runat="server" Text="Cancel" CausesValidation="false" CommandName="Cancel"></asp:Button>
                            </td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
        <ClientSettings AllowExpandCollapse="true" />
    </telerik:RadGrid>

The code behind is: (omitted some code that is not relevant)
using System;
using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls;
using admin_bl;
using admin_bo;
using Telerik.Web.UI;
 
namespace admin
{
    public partial class MENU_MenuItem_Hierarchy : bl_BasePage
    {
        #region "Properties"
 
        private string _strAppMode = string.Empty;
        private Hashtable _htOdsValues;
 
        private bool _isRowFound = false;
        private long _lMenuInstanceIDFilter;
 
        #endregion
 
        #region "Page Load Methods"
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
                return;
 
            SetGridDisplay();
 
            SetInitialFilter();
        }
 
        public void Page_PreRenderComplete(object sender, EventArgs e)
        {
            HideExpandColumnRecursive(this.RG_MENU_MenuItem.MasterTableView);
        }
 
        /// <summary>
        /// Changes the grid display based on the ApplicationMode
        /// </summary>
        private void SetGridDisplay()
        {
            this._strAppMode = (Convert.ToInt32(bl_ApplicationData.AppMode)).ToString();
            this.txtAppMode.Text = this._strAppMode;
 
            if (bl_ApplicationData.AppMode == bl_ApplicationData.ApplicationMode.SYNCRONIZATION)
            {
                //disable insert, update & delete
                this.RG_MENU_MenuItem.AllowAutomaticInserts = false;
                this.RG_MENU_MenuItem.AllowAutomaticUpdates = false;
                this.RG_MENU_MenuItem.AllowAutomaticDeletes = false;
                //hide edit & delete columns and show select column
                this.RG_MENU_MenuItem.MasterTableView.GetColumn("EditColumn").Display = false;
                this.RG_MENU_MenuItem.MasterTableView.GetColumn("DeleteColumn").Display = false;
                this.RG_MENU_MenuItem.MasterTableView.GetColumn("SelectColumn").Display = true;
                //show buttons
                this.bDoSyncUP.Visible = true;
                this.bDoSyncDOWN.Visible = true;
                // confirm message
                this.bDoSyncUP.Attributes.Add("OnClick", "return confirm('Jeste li sigurni da želite pokrenuti sinkronizaciju? ');");
                this.bDoSyncDOWN.Attributes.Add("OnClick", "return confirm('Jeste li sigurni da želite pokrenuti sinkronizaciju? ');");
                //set sync legend colors and show it
                this.WUC_sync_legend1.bckColorInsert = bl_ApplicationData.BckColorInsert;
                this.WUC_sync_legend1.bckColorUpdate = bl_ApplicationData.BckColorUpdate;
                this.WUC_sync_legend1.bckColorDelete = bl_ApplicationData.BckColorDelete;
                this.WUC_sync_legend1.isSyncMode = true;
            }
            else if (bl_ApplicationData.AppMode == bl_ApplicationData.ApplicationMode.ADMINISTRATION)
            {
                this.RG_MENU_MenuItem.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
            }
        }
 
        private void SetInitialFilter()
        {
            this.RG_MENU_MenuItem.MasterTableView.FilterExpression = "(it.ParentItemID == 0)";
            //glavni menu initial filter
            this.rcbMenuInstanceFilter.SelectedValue = "8";
            SetMenuInstanceFilter("8");
        }
 
        #endregion
 
        #region "RadGrid Events"
 
        protected void RG_MENU_MenuItem_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            GetDataSource();
        }
 
        protected void RG_MENU_MenuItem_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
        {
            if (e.Column is GridExpandColumn)
            {
                e.Column.Visible = false;
            }
            else if (e.Column is GridBoundColumn)
            {
                e.Column.HeaderStyle.Width = Unit.Pixel(100);
            }
        }
 
        protected void RG_MENU_MenuItem_ItemDataBound(object sender, GridItemEventArgs e)
        {
            CreateExpandCollapseButton(e.Item, "MenuItemID");
        }
 
        protected void RG_MENU_MenuItem_ItemCreated(object sender, GridItemEventArgs e)
        {
            CreateExpandCollapseButton(e.Item, "MenuItemID");
 
            //e.Item.Expanded = false;
 
            if (e.Item is GridHeaderItem && e.Item.OwnerTableView != this.RG_MENU_MenuItem.MasterTableView)
            {
                e.Item.Style["display"] = "none";               
            }
 
            if (e.Item is GridNestedViewItem)
            {
                e.Item.Cells[0].Visible = false;               
            }           
 
            if (bl_ApplicationData.AppMode == bl_ApplicationData.ApplicationMode.ADMINISTRATION)
            {
                this.ItemCreatedAdmin(e);
            }
            else if (bl_ApplicationData.AppMode == bl_ApplicationData.ApplicationMode.SYNCRONIZATION)
            {
                this.ItemCreatedSync(e);
            }
        }
 
        protected void RG_MENU_MenuItem_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "CustomEdit")
            {
                EditRow(e);
            }
        }
 
        protected void RG_MENU_MenuItem_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GetValues(e);
 
            Insert();
        }
 
        protected void RG_MENU_MenuItem_UpdateCommand(object sender, GridCommandEventArgs e)
        {
            GetValues(e);
 
            Update(e);
        }
 
        protected void RG_MENU_MenuItem_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            Delete(e);
        }
 
        public void SelectAll_CheckedChanged(object sender, EventArgs e)
        {
            this.RG_MENU_MenuItem.Rebind();
 
            foreach (GridDataItem item in this.RG_MENU_MenuItem.MasterTableView.Items)
            {
                (item.FindControl("cbxSelectForSync") as CheckBox).Checked = (sender as CheckBox).Checked;
            }
        }
 
        #endregion
 
        #region "Insert - Update - Delete"
 
        private void Insert()
        {
            string strMessage = String.Empty;
            bool isInserted = false;
 
            new bl_MENU_MenuItem().Insert(Convert.ToInt64(this._htOdsValues["ParentItemID"])
                                        , Convert.ToInt64(this._htOdsValues["MenuInstanceID"])
                                        , Convert.ToInt64(this._htOdsValues["PageID"])
                                        , this._htOdsValues["MenuItemUrl"].ToString()
                                        , this._htOdsValues["AppDescription"].ToString()
                                        , Convert.ToInt32(this._htOdsValues["WebOrder"])
                                        , Convert.ToBoolean(this._htOdsValues["IsActive"])
                                        , base.LoggedUser.UserID
                                        , Convert.ToInt32(this._htOdsValues["PriorityFactor"])
                                        , out isInserted
                                        , out strMessage);
 
            DisplayMessage(!isInserted, strMessage);
        }
 
        private void Update(GridCommandEventArgs e)
        {
            string strMessage = String.Empty;
            bool isUpdated = false;
 
            long lMenuItemID = Convert.ToInt64((e.Item as GridEditableItem).GetDataKeyValue("MenuItemID"));
 
            new bl_MENU_MenuItem().Update(lMenuItemID
                                        , Convert.ToInt64(this._htOdsValues["ParentItemID"])
                                        , Convert.ToInt64(this._htOdsValues["MenuInstanceID"])
                                        , Convert.ToInt64(this._htOdsValues["PageID"])
                                        , this._htOdsValues["MenuItemUrl"].ToString()
                                        , this._htOdsValues["AppDescription"].ToString()
                                        , Convert.ToInt32(this._htOdsValues["WebOrder"])
                                        , Convert.ToBoolean(this._htOdsValues["IsActive"])
                                        , base.LoggedUser.UserID
                                        , Convert.ToInt32(this._htOdsValues["PriorityFactor"])
                                        , out isUpdated
                                        , out strMessage);
 
            DisplayMessage(!isUpdated, strMessage);
        }
 
        private void Delete(GridCommandEventArgs e)
        {
            string strMessage = String.Empty;
            bool isDeleted = false;
 
            long lMenuItemID = Convert.ToInt64((e.Item as GridEditableItem).GetDataKeyValue("MenuItemID"));
 
            new bl_MENU_MenuItem().Delete(lMenuItemID
                                        , out isDeleted
                                        , out strMessage);
 
            DisplayMessage(!isDeleted, strMessage);
        }
 
        #endregion
 
        #region "ObjectDataSource Events"
 
        protected void ods_MENU_MenuItem_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
        {
            SetOdsValues(e);
        }
 
        protected void ods_MENU_MenuItem_Updating(object sender, ObjectDataSourceMethodEventArgs e)
        {
            SetOdsValues(e);
        }
 
        protected void ods_MENU_MenuItem_Deleting(object sender, ObjectDataSourceMethodEventArgs e)
        {
 
        }
 
        protected void ods_MENU_MenuItem_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
        {
            DisplayMessage(!Convert.ToBoolean(e.OutputParameters["pIsInserted"]), Convert.ToString(e.OutputParameters["pMessage"]));
        }
 
        protected void ods_MENU_MenuItem_Updated(object sender, ObjectDataSourceStatusEventArgs e)
        {
            DisplayMessage(!Convert.ToBoolean(e.OutputParameters["pIsUpdated"]), Convert.ToString(e.OutputParameters["pMessage"]));
        }
 
        protected void ods_MENU_MenuItem_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
        {
            DisplayMessage(!Convert.ToBoolean(e.OutputParameters["pIsDeleted"]), Convert.ToString(e.OutputParameters["pMessage"]));
        }
 
        #endregion
 
        #region "Other Events"
 
        protected void button_Click(object sender, EventArgs e)
        {
            ((Button)sender).CssClass = (((Button)sender).CssClass == "rgExpand") ? "rgCollapse" : "rgExpand";
        }
 
        protected void rcbMenuInstanceFilter_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            SetMenuInstanceFilter(e.Value);
        }
 
        #endregion
 
        #region "Utility Methods"
 
        public void GetDataSource()
        {
            RG_MENU_MenuItem.DataSource = new bl_MENU_MenuItem().GetAll( this.txtSortExpression.Text
                                                                       , Convert.ToBoolean(this.txtSortDirection.Text)
                                                                       , this.txtAppMode.Text);
        }
 
        public void HideExpandColumnRecursive(GridTableView pTableView)
        {
            GridItem[] nestedViewItems = pTableView.GetItems(GridItemType.NestedView);
            foreach (GridNestedViewItem nestedViewItem in nestedViewItems)
            {
                foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)
                {
                    nestedView.Style["border"] = "0";
 
                    Button btnExpandCollapseButton = (Button)nestedView.ParentItem.FindControl("btnExpandCollapseButton");
                    if (nestedView.Items.Count == 0)
                    {
                        if (btnExpandCollapseButton != null)
                        {
                            btnExpandCollapseButton.Style["visibility"] = "hidden";
                        }
                        nestedViewItem.Visible = false;
                    }
                    else
                    {
                        if (btnExpandCollapseButton != null)
                        {
                            btnExpandCollapseButton.Style.Remove("visibility");
                        }
                    }
 
                    if (nestedView.HasDetailTables)
                    {
                        HideExpandColumnRecursive(nestedView);
                    }
                }
            }
        }
 
        public void CreateExpandCollapseButton(GridItem pItem, string pColumnUniqueName)
        {
            if (pItem is GridDataItem)
            {
                if (pItem.FindControl("btnExpandCollapseButton") == null)
                {
                    Button button = new Button();
                    button.Click += new EventHandler(button_Click);
                    button.CommandName = "ExpandCollapse";
                    button.CssClass = (pItem.Expanded) ? "rgCollapse" : "rgExpand";
                    button.ID = "btnExpandCollapseButton";
 
                    if (pItem.OwnerTableView.HierarchyLoadMode == GridChildLoadMode.Client)
                    {
                        string script = String.Format(@"$find(""{0}"")._toggleExpand(this, event); return false;", pItem.Parent.Parent.ClientID);
 
                        button.OnClientClick = script;
                    }
 
                    int level = pItem.ItemIndexHierarchical.Split(':').Length - 1;
 
                    button.Style["margin-left"] = level * 15 + "px";
 
                    TableCell cell = ((GridDataItem)pItem)[pColumnUniqueName];
                    cell.Controls.Add(button);
                    cell.Controls.Add(new LiteralControl(" "));
                    cell.Controls.Add(new LiteralControl(((GridDataItem)pItem).GetDataKeyValue(pColumnUniqueName).ToString()));
                }
            }
        }
 
        private void DisplayMessage(bool pIsError, string pText)
        {
            if (pIsError == true)
            {
                this.lblActionNotOk.Visible = true;
                this.lblActionNotOk.Text = pText;
                this.lblActionOk.Visible = false;
            }
            else
            {
                this.lblActionOk.Visible = true;
                this.lblActionOk.Text = pText;
                this.lblActionNotOk.Visible = false;
            }
        }
 
        private void ItemCreatedAdmin(GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditFormItem geiEditedItem = e.Item as GridEditFormItem;
                geiEditedItem.Visible = true;
 
                if (e.Item.DataItem is bo_MENU_MenuItem)
                {
                    bo_MENU_MenuItem boCurrent = (bo_MENU_MenuItem)e.Item.DataItem;
 
                    RadComboBox rcbParentItemID = geiEditedItem.FindControl("rcbParentItemID") as RadComboBox;
                    rcbParentItemID.SelectedValue = boCurrent.ParentItemID != 0 ? boCurrent.ParentItemID.ToString() : "";
 
                    RadComboBox rcbMenuInstanceID = geiEditedItem.FindControl("rcbMenuInstanceID") as RadComboBox;
                    rcbMenuInstanceID.SelectedValue = boCurrent.MenuInstance.MenuInstanceID.ToString();
 
                    RadComboBox rcbPageID = geiEditedItem.FindControl("rcbPageID") as RadComboBox;
                    rcbPageID.SelectedValue = boCurrent.Page.PageID != 0 ? boCurrent.Page.PageID.ToString() : String.Empty;
 
                    RadTextBox txtMenuItemUrl = geiEditedItem.FindControl("txtMenuItemUrl") as RadTextBox;
                    txtMenuItemUrl.Text = boCurrent.MenuItemUrl.ToString();
 
                    RadTextBox txtAppDescription = geiEditedItem.FindControl("txtAppDescription") as RadTextBox;
                    txtAppDescription.Text = boCurrent.AppDescription.ToString();
 
                    RadNumericTextBox rnbWebOrder = geiEditedItem.FindControl("rnbWebOrder") as RadNumericTextBox;
                    rnbWebOrder.Text = boCurrent.WebOrder.ToString();
 
                    CheckBox chbIsActive = geiEditedItem.FindControl("chbIsActive") as CheckBox;
                    chbIsActive.Checked = boCurrent.IsActive;
 
                    RadNumericTextBox rnbPriorityFactor = geiEditedItem.FindControl("rnbPriorityFactor") as RadNumericTextBox;
                    rnbPriorityFactor.Text = boCurrent.PriorityFactor.ToString();
                }
            }
        }
 
        private void ItemCreatedSync(GridItemEventArgs e)
        {
             
        }
 
        private void GetValues(GridCommandEventArgs e)
        {
            this._htOdsValues = new Hashtable();
            this._htOdsValues.Add("ParentItemID", Convert.ToInt64(((e.Item as GridEditableItem).FindControl("rcbParentItemID") as RadComboBox).SelectedValue != String.Empty ? ((e.Item as GridEditableItem).FindControl("rcbParentItemID") as RadComboBox).SelectedValue : "0"));
            this._htOdsValues.Add("MenuInstanceID", Convert.ToInt64(((e.Item as GridEditableItem).FindControl("rcbMenuInstanceID") as RadComboBox).SelectedValue));
            this._htOdsValues.Add("PageID", Convert.ToInt64(((e.Item as GridEditableItem).FindControl("rcbPageID") as RadComboBox).SelectedValue != String.Empty ? ((e.Item as GridEditableItem).FindControl("rcbPageID") as RadComboBox).SelectedValue : "0"));
            this._htOdsValues.Add("MenuItemUrl", ((e.Item as GridEditableItem).FindControl("txtMenuItemUrl") as RadTextBox).Text);
            this._htOdsValues.Add("AppDescription", ((e.Item as GridEditableItem).FindControl("txtAppDescription") as RadTextBox).Text);
            this._htOdsValues.Add("WebOrder", Convert.ToInt32(((e.Item as GridEditableItem).FindControl("rnbWebOrder") as RadNumericTextBox).Text));
            this._htOdsValues.Add("IsActive", ((e.Item as GridEditableItem).FindControl("chbIsActive") as CheckBox).Checked);
            this._htOdsValues.Add("PriorityFactor", Convert.ToInt32(((e.Item as GridEditableItem).FindControl("rnbPriorityFactor") as RadNumericTextBox).Text));
        }
 
        private void SetOdsValues(ObjectDataSourceMethodEventArgs e)
        {
            e.InputParameters["ParentItemID"] = this._htOdsValues["ParentItemID"];
            e.InputParameters["MenuInstanceID"] = this._htOdsValues["MenuInstanceID"];
            e.InputParameters["PageID"] = this._htOdsValues["PageID"];
            e.InputParameters["MenuItemUrl"] = this._htOdsValues["MenuItemUrl"];
            e.InputParameters["AppDescription"] = this._htOdsValues["AppDescription"];
            e.InputParameters["WebOrder"] = this._htOdsValues["WebOrder"];
            e.InputParameters["IsActive"] = this._htOdsValues["IsActive"];
            e.InputParameters["UserID"] = base.LoggedUser.UserID;
            e.InputParameters["PriorityFactor"] = this._htOdsValues["PriorityFactor"];
        }
 
        private void EditRow(GridCommandEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem gdiItem = (GridDataItem)e.Item;
                long lMenuItemID = Convert.ToInt64(gdiItem.GetDataKeyValue("MenuItemID"));
                this._isRowFound = false;
 
                if (this.RG_MENU_MenuItem.MasterTableView.FindItemByKeyValue("MenuItemID", lMenuItemID) != null)
                    this.RG_MENU_MenuItem.MasterTableView.FindItemByKeyValue("MenuItemID", lMenuItemID).Edit = true;
                else
                    EditRowRecursive(this.RG_MENU_MenuItem.MasterTableView, lMenuItemID);
 
                this.RG_MENU_MenuItem.Rebind();
            }
        }
 
        private void EditRowRecursive(GridTableView pTableView, long pMenuItemID)
        {
            GridItem[] nestedViewItems = pTableView.GetItems(GridItemType.NestedView);
            foreach (GridNestedViewItem nestedViewItem in nestedViewItems)
            {
                if (this._isRowFound)
                    return;
 
                foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)
                {
                    if (nestedView.FindItemByKeyValue("MenuItemID", pMenuItemID) != null)
                    {
                        nestedView.FindItemByKeyValue("MenuItemID", pMenuItemID).Edit = true;
                        this._isRowFound = true;
                        return;
                    }
 
                    if (nestedView.HasDetailTables)
                    {
                        EditRowRecursive(nestedView, pMenuItemID);
                    }
                }               
            }
        }
 
        private void SetMenuInstanceFilter(string pMenuInstanceID)
        {
            this._lMenuInstanceIDFilter = Convert.ToInt64(pMenuInstanceID.Equals(String.Empty) ? "0" : pMenuInstanceID);
 
            this.locTitle.Text = "UreÄ‘ivanje Stavki Menua";
            this.RG_MENU_MenuItem.MasterTableView.FilterExpression = "(it.ParentItemID == 0)";
 
            this.txtMenuInstanceID.Text = this._lMenuInstanceIDFilter.ToString();
 
            GridColumn gdcMenuInstanceID = this.RG_MENU_MenuItem.MasterTableView.GetColumnSafe("MenuInstanceID");
 
            if (this._lMenuInstanceIDFilter == 0)
            {
                gdcMenuInstanceID.CurrentFilterFunction = GridKnownFunction.NoFilter;
                gdcMenuInstanceID.CurrentFilterValue = String.Empty;
            }
            else
            {
                this.locTitle.Text += " za MenuInstanceID = " + this.txtMenuInstanceID.Text;
                this.RG_MENU_MenuItem.MasterTableView.FilterExpression += " AND (it.MenuInstanceID == " + this.txtMenuInstanceID.Text + ")";
 
                gdcMenuInstanceID.CurrentFilterFunction = GridKnownFunction.EqualTo;
                gdcMenuInstanceID.CurrentFilterValue = this.txtMenuInstanceID.Text;
            }
 
            this.RG_MENU_MenuItem.MasterTableView.Rebind();
        }
 
        #endregion
 
        #endregion
    }
}

Please help me to have my self-referencing grid initially collapsed and with working edit forms.
Tsvetina
Telerik team
 answered on 18 Nov 2010
2 answers
130 views
Hi,
  Personally, I love radScheduler and I love how it performs in FF, but my clients like IE and radScheduler just don't have good performance in IE.
  I already checked the suggestion in http://www.telerik.com/products/aspnet-ajax/resources/top-performance.aspx, but it's not helping much.  We don't use web or WCF web service binding.  Is there anything else we can do to improve the performance in IE? 
T. Tsonev
Telerik team
 answered on 18 Nov 2010
1 answer
172 views
Hello guys. I'm attempting to tackle a situation where, in the database, there are three columns in a table called JobDate, StartTime, and EndTime. StartTime and EndTime are also stored as a smalldatetime like JobDate. Also, the date portion of StartTime and EndTime is equal to JobDate.

Now, upon clicking the Edit Icon, I see the results as shown in "step-01". Although the values are correct, it still shows up as incorrect. Upon clicking either of the two field while in edit mode, the results achieved are shown in "step-02".

I don't want to show the date portion while editing StartTime and EndTime. This because the date portion will be same as JobDate and a JobDate cannot be changed. Not even by an accident.

Kindly help.

<telerik:RadGrid ID="RadGridJobs" runat="server" AutoGenerateColumns="False" AllowPaging="True" PageSize="25" AllowSorting="false" GridLines="None" Width="885px" Skin="Office2007" SkinID="RadGrid_UnPageable" OnNeedDataSource="RadGridJobs_NeedDataSource" OnUpdateCommand="RadGridJobs_UpdateCommand" OnDeleteCommand="RadGridJobs_DeleteCommand" OnItemCreated="RadGridJobs_ItemCreated">
<MasterTableView ClientDataKeyNames="OID" DataKeyNames="OID" CommandItemDisplay="Top">
  <Columns>
    <telerik:GridBoundColumn DataField="PharmacyName" HeaderText="Pharmacy" ReadOnly="True" SortExpression="PharmacyName"
      UniqueName="columnPharmacy" />
    <telerik:GridBoundColumn DataField="CoordinatorName" HeaderText="Coordinator" ReadOnly="true" SortExpression="CoordinatorName"
      UniqueName="columnCoordinator" />
    <telerik:GridBoundColumn DataField="JobDate" HeaderText="Date" ReadOnly="true" SortExpression="JobDate"
      UniqueName="columnDate" DataType="System.DateTime" DataFormatString="{0:dd-MMM-yyyy}" />
    <telerik:GridBoundColumn DataField="StartTime" HeaderText="Start" UniqueName="columnStart" DataType="System.DateTime"
      DataFormatString="{0:hh:mm tt}" />
    <telerik:GridBoundColumn DataField="EndTime" HeaderText="End" UniqueName="columnEnd" DataType="System.DateTime"
      DataFormatString="{0:hh:mm tt}" />
    <telerik:GridBoundColumn DataField="Rate" HeaderText="Rate" UniqueName="columnRate" DataType="System.Decimal"
      DataFormatString="{0:c}" />
    <telerik:GridBoundColumn DataField="RatePlus" HeaderText="Rate +" UniqueName="columnRatePlus" DataType="System.Decimal"
      DataFormatString="{0:c}" />
    <telerik:GridEditCommandColumn ButtonType="ImageButton" />
    <telerik:GridButtonColumn ConfirmText="Delete this Job?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete"
      ButtonType="ImageButton" CommandName="Delete" />
    <telerik:GridTemplateColumn HeaderText="" UniqueName="NoteColumn" HeaderStyle-Width="10px" ItemStyle-Width="10px">
      <ItemTemplate>
    <a href="../Notes/NotesManager.aspx?RecordID=<%# Eval("OID") %>&NoteTypeID=3">
      <asp:Image ID="ImageEditNote" runat="server" ImageUrl="~/Images/notes-icon.gif" AlternateText="Add notes"
        Width="15px" ToolTip="Add notes" />
    </a>
      </ItemTemplate>
      <HeaderStyle Width="10px"></HeaderStyle>
      <ItemStyle Width="10px"></ItemStyle>
    </telerik:GridTemplateColumn>
  </Columns>
  <EditFormSettings>
    <EditColumn ButtonType="ImageButton" />
  </EditFormSettings>
  <CommandItemSettings ShowRefreshButton="true" ShowAddNewRecordButton="false" ShowExportToWordButton="false"
    ShowExportToExcelButton="true" ShowExportToPdfButton="true" ShowExportToCsvButton="true" />
  <PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" Position="TopAndBottom" />
</MasterTableView>
<ExportSettings HideStructureColumns="false" />
<ClientSettings>
  <Selecting AllowRowSelect="True" />
  <ClientEvents OnRowDblClick="RadGridJobs_OnRowDblClick" />
  <Scrolling UseStaticHeaders="True" />
</ClientSettings>
</telerik:RadGrid>
 
<telerik:RadInputManager runat="server" ID="RadInputManagerJobs" Enabled="true">
  <telerik:DateInputSetting BehaviorID="DateInputSettingStartEnd" DateFormat="hh:mm:ss tt"  DisplayDateFormat="hh:mm tt" EmptyMessage="Cannot be empty" ErrorMessage="Enter valid time" />
  <telerik:NumericTextBoxSetting BehaviorID="NumericTextBoxSettingRate" Type="Currency" AllowRounding="true" DecimalDigits="2" MinValue="0" EmptyMessage="Cannot be empty" ErrorMessage="Enter valid currency" />
</telerik:RadInputManager>
Veli
Telerik team
 answered on 18 Nov 2010
6 answers
1.3K+ views
Hello,

I am in the process of building a control that registers some javascript after each postback (regular or ajax).  This is done in the PreRender event of the control and looks something like this:

ScriptManager.RegisterStartupScript(thisthis.GetType(), this.ClientID + "_SplitterBarStartupScript", sb.ToString(), true);  
 

This works fine both when using no Ajax panel at all and also when using the ASP.NET UpdatePanel.  After each postback the script is injected correctly and runs.  This doesn't work with the RadAjaxPanel though.

I did some testing and found that RegisterClientScriptBlock does fire with the RadAjaxPanel after each postback.  I do not want to use this however because the script is injected before the elements have been loaded (too early).

I have also seen suggestions on the forum to use the RadAjaxPanel's ClientScripts collection.  This will also not work for me because this is a custom control and doesn't know what other controls are included on the page.

I would like this to work in all 3 scenarios: regular postback, ASP.NET UpdatePanel and RadAjaxPanel.

Please advise as to how I should proceed.

Thanks,
Kevin
sahil
Top achievements
Rank 1
 answered on 18 Nov 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?