Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
129 views
Hi,
I have a grid with 3 level hierarchy. I wanted to get the client id of the expaned/collapsed detailtable when the expand/collapse image button is clicked.The detailtable just below the button expanded/collapse.
I can get this work for two level by the following code
 <ClientSettings AllowExpandCollapse="True"> 
                                <ClientEvents OnHierarchyCollapsed="Collapsed" /> 
                                <ClientEvents OnHierarchyExpanded="Expanded" /> 
</ClientSettings> 
 
<script type="text/javascript" language="javascript"> 
 
    function Collapsed(sender, eventArgs) { 
        var radgrid = sender; 
        var detailTablesArray = radgrid.get_detailTables(); 
        document.getElementById(detailTablesArray[eventArgs.get_itemIndexHierarchical()]._data.ClientID).style.display = "none"; 
 
    } 
 
    function Expanded(sender, eventArgs) { 
        var radgrid = sender; 
        var detailTablesArray = radgrid.get_detailTables(); 
        document.getElementById(detailTablesArray[eventArgs.get_itemIndexHierarchical()]._data.ClientID).style.display = "inline"; 
 
    } 
</script> 



But  incase of 3 level hierarchy i get the value of "eventArgs.get_itemIndexHierarchical()" for the level two "expand/collapse" click as something like "2:0_2" and hence not able to index the detailtable array.
I need to do this for totally different issue though it seems from code above that i am just hiding / showing the detail table. All i need is the client id for the detailtable for the expanded/collapsed row.

Appreciate any help on this.
Thanks,
Sudhir.
sudhir singh
Top achievements
Rank 1
 answered on 05 May 2010
3 answers
164 views

It disappeared so I had to use this:

if (e.Item is GridGroupFooterItem)  
        {  
            GridGroupFooterItem groupedItem = e.Item as GridGroupFooterItem;  
            groupedItem.Style["width"] = "20px";  
            groupedItem.Style["height"] = "20px";  
            groupedItem.Style["background-color"] = "lightgray";  
            groupedItem.Style["font-size"] = "11px";  
            groupedItem.Style["font-family"] = "Verdana";  
            groupedItem.Style["text-align"] = "right";               
            groupedItem.Style["font-weight"] = "bold";  
            groupedItem.Style["vertical-align"] = "text-top";        } 
Pavlina
Telerik team
 answered on 05 May 2010
1 answer
178 views
I have this problem which i've been trying to resolve for quite awhile.

Here's what i have:
  1. RadControls AJAX 2010.1 309
  2. RadAjaxManagerProxy on a page
  3. RadGrid 
  4. User control that's used to edit record
  5. TabStrip and MultiPage in the usercontrol
  6. "Update & Next" button in the user control that saves edited record and moves to the next record.

Everything seems to work fine, except:
  1. When click Edit for the same record twice the the tabs stop changing pages within MultiPage
  2. The tabs themselves get changes, but not the content within Multipage
  3. If i go to another record i can change tabs ok.
  4. Basically the first time i edit a record the tabs work, and if i try to edit it again it does not work
  5. It irrespective of the page i'm in
  6. Tabs on records with the same index on the page don't work on any page.

So it appears that those lines that i've opened to edit get "locked" and after that tabstrip or mutipage stops working.

Has anybody had the same issue found a solution for this scenario?

Some code snippets:
My page:
        <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"> 
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="rgEntries"> 
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="rgEntries" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
                [cut] 
            </AjaxSettings> 
        </telerik:RadAjaxManagerProxy> 

        <telerik:RadGrid ID="rgEntries" runat="server" AllowPaging="True" 
            AllowSorting="True" GridLines="None" ShowFooter="True" ShowStatusBar="True" AllowCustomPaging="True" AutoGenerateColumns="False"  
             OnNeedDataSource="rgEntries_NeedDataSource" OnDeleteCommand="rgEntries_DeleteCommand" OnInsertCommand="rgEntries_InsertCommand" OnUpdateCommand="rgEntries_UpdateCommand" OnItemCommand="rgEntries_ItemCommand"> 
            <ExportSettings IgnorePaging="True" OpenInNewWindow="True" ExportOnlyData="True" filename="TimeEntriesExport" > 
<Pdf Title="Time Entries Export" PaperSize="A4" PageWidth="297mm" PageHeight="210mm"></Pdf> 
</ExportSettings> 
            <MasterTableView CommandItemDisplay="Top" DataKeyNames="ID" AllowCustomSorting="True" EditMode="EditForms"> 
                <CommandItemSettings ShowExportToExcelButton="True" ShowExportToWordButton="True" ShowExportToCsvButton="True"></CommandItemSettings> 
                <Columns> 
                    <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> 
                    [cut] 
                </Columns> 
 
                <EditFormSettings EditFormType="WebUserControl" UserControlName="Controls\TimeEntryDetails.ascx"> 
                <EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
                </EditFormSettings> 
                </MasterTableView> 
                <ClientSettings AllowDragToGroup="True"> 
                <Selecting AllowRowSelect="True"></Selecting> 
                <ClientEvents OnRowDblClick="RowDblClick"></ClientEvents> 
                </ClientSettings> 
            <HeaderContextMenu EnableAutoScroll="True"> 
            </HeaderContextMenu> 
        </telerik:RadGrid> 
 

        protected void rgEntries_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
        { 
            int? totals  = null; 
            EntryCollection entries = GetEntries(ref totals, rgEntries.CurrentPageIndex); 
 
            rgEntries.DataSource = entries; 
            rgEntries.VirtualItemCount = totals.Value; 
        } 

        protected void rgEntries_UpdateCommand(object source, GridCommandEventArgs e) 
        { 
            bool moveNext = true; 
 
            CRMAdmin.Controls.TimeEntryDetails userControl = 
(CRMAdmin.Controls.TimeEntryDetails)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); 
            Entry entry = 
                CRMService.Default.Repository.Fetch<Entry>( 
                    (Guid)rgEntries.MasterTableView.DataKeyValues[e.Item.ItemIndex]["ID"], false); 
 
            userControl.LoadToObject(entry); 
 
            if (!entry.IsDirty) 
            { 
                if (moveNext) 
                { 
                    if (e.Item.ItemIndex < rgEntries.Items.Count - 1) 
                    { 
                        rgEntries.Items[e.Item.ItemIndex + 1].Edit = true; 
                    } 
                    else 
                    { 
                        rgEntries.CurrentPageIndex++; 
                        rgEntries.Items[0].Edit = true; 
                    } 
                } 
                return; //nothing changed 
            } 
 
            ValidationResults val = entry.Validate(); 
            if (val.IsValid) 
            { 
                try 
                { 
                    using (TransactionScope scope = new TransactionScope()) 
                    { 
                        string userName = System.Web.HttpContext.Current != null ? System.Web.HttpContext.Current.User.Identity.Name : string.Empty; 
 
                        entry.Save(userName); 
 
                        scope.Complete(); 
                    } 
 
                    if (moveNext) 
                    { 
                        if (e.Item.ItemIndex < rgEntries.Items.Count - 1) 
                        { 
                            rgEntries.Items[e.Item.ItemIndex + 1].Edit = true; 
                        } 
                        else 
                        { 
                            rgEntries.CurrentPageIndex++; 
                            rgEntries.Items[0].Edit = true; 
                        } 
                    } 
                } 
                catch (Exception ex) 
                { 
                    Label lblError = new Label(); 
                    lblError.Text = "Unable to update Time Entry. Reason: " + ex.Message; 
                    lblError.ForeColor = System.Drawing.Color.Red; 
                    rgEntries.Controls.Add(lblError); 
 
                    e.Canceled = true; 
                } 
            } 
            else 
            { 
                Validator validator = new Validator(); 
                validator.IsValid(entry as IRepositoryRecord); 
                rgEntries.Controls.Add(validator); 
 
                e.Canceled = true; 
            } 
        } 

User Control:
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0" ShowBaseLine="True" EnableViewState="false"> 
        <Tabs> 
            <telerik:RadTab runat="server" Text="Common" Selected="True"></telerik:RadTab> 
            <telerik:RadTab runat="server" Text="Other" Value="Other"></telerik:RadTab> 
            <telerik:RadTab runat="server" Text="Audit History" Value="AuditHistory"></telerik:RadTab> 
        </Tabs> 
    </telerik:RadTabStrip> 
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" ScrollBars="None" EnableViewState="true"> 
        <telerik:RadPageView ID="rpvCommon" runat="server"> 
            [cut] 
</telerik:RadPageView> 
</telerik:RadMultiPage> 

<asp:button id="btnUpdate" text="Update & Next" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'></asp:button> 

protected Object _dataItem = new object(); 
 
        public object DataItem 
        { 
            get { return this._dataItem; } 
            set { this._dataItem = value; } 
        } 

        protected override void OnDataBinding(EventArgs e) 
        { 
            base.OnDataBinding(e); 
 
            //setup control values from DataItem  
            [cut] 
        } 
 


Iana Tsolova
Telerik team
 answered on 05 May 2010
8 answers
591 views

Hi All, I am following the Load on Demand RadPageView example and everything is working correctly except for the fact that I am trying to load PageIndex  2 and show PageIndex 2. When I do this the tab shows up blank as if nothing was loaded. I believe the actual tab is loading but at index 0, any guidance or a how to will be much appreciated.

Thanks

-----------

 

 

protected void Page_Load(object sender, EventArgs e)

 

{

 

 

if (!Page.IsPostBack)

 

{

AddTab(

 

"General Information");

 

AddTab(

 

"Change Password");

 

AddTab(

 

"Quick Links");

 

AddTab(

 

"Application Access");

 

 

 

int i = -1;

 

 

 

if (Request.QueryString["PageIndex"] != null)

 

 

 

Int32.TryParse(Request.QueryString["PageIndex"], out i);

 

 

 

switch (i)

 

{

 

 

case 2:

 

RadMultiProfile.SelectedIndex = 2;

RadTabProfile.SelectedIndex = 2;

AddPageView(RadTabProfile.FindTabByText(

 

"Quick Links"));

 

 

 

 

break;

 

 

 

default:

 

AddPageView(RadTabProfile.FindTabByText(

 

"General Information"));

 

 

 

break;

 

}

 

}

}

 

 

private void AddTab(string tabName)

 

{

 

 

RadTab tab = new RadTab();

 

tab.Text = tabName;

RadTabProfile.Tabs.Add(tab);

}

 

 

private void AddPageView(RadTab tab)

 

{

 

 

RadPageView pageView = new RadPageView();

 

pageView.ID = tab.Text;

RadMultiProfile.PageViews.Add(pageView);

tab.PageViewID = pageView.ID;

}

 

 

protected void RadTabProfile_TabClick(object sender, RadTabStripEventArgs e)

 

{

AddPageView(e.Tab);

e.Tab.PageView.Selected =

 

true;

 

}

 

 

protected void RadMultiProfile_PageViewCreated(object sender, RadMultiPageEventArgs e)

 

{

 

 

string userControlName = "Controls/" + e.PageView.ID.Replace(" ", "") + ".ascx";

 

 

 

Control userControl = Page.LoadControl(userControlName);

 

userControl.ID = e.PageView.ID +

 

"_userControl";

 

e.PageView.Controls.Add(userControl);

}

Jorge Cardenas
Top achievements
Rank 2
 answered on 05 May 2010
2 answers
280 views
Hi,

   I have a RadPane that I need to resize depending on the situation. I found this pane method resize which can be set to resize forward or backward which is exactly what I need. However, it seems that it only works for forward everytime and not with backward orientation.

   Here's the code I used for it:

   function setPaneHeight(toExpand)
   { 
            var pane = $find('<% pnlMainPanel.ClientID %>');
            var isResized = document.getElementById('isMainPaneResized').value; //set to 1 or 0 if pane is resized already or not yet respectively
            if (toExpand = "true")
            {
                    if (isResized=="0") // not yet expanded or resized
                    {
                         pane.resize(25,2); //expand forward by 25 pixels
                         document.getElementById('isMainPaneResized').value = "1";
                    }
                    else //already expanded
                    {
                        //just do nothing
                    }
            }
            else // to contract pane
            {
                    if (isResized == "0") //not yet expanded or resized
                    {
                        // just don't do anything
                    }
                    else
                    {
                            pane.resize (25,1); resize backwards by 25 pixels;
                            document.getElementById('isMainPaneResized').value = "0";
                    }
            }
        
   }

   With this code above, I send a value of 1 (to expand) or 0 (to contract) and issue a pane resize correspondingly. And then I set the hidden field 'isMainPaneResized' so that I would know when to set it back to its original size. Basically when it is already expanded and I hit expand request again to this function, I would just not do anything. But if it is not yet expanded, I would then expand it and set the hidden value to expanded (1). And when it is already expanded (hidden value is already set to 1) and I send a "to contract" request, I would then "contract" it otherwise, I would just not do anything.

   Please let me know if you have any further clarifications on this matter.

Thanks,
Arthur
Hansik
Top achievements
Rank 1
 answered on 05 May 2010
1 answer
138 views
I have a MasterPage with a RadTreeView that I would like to use to navigate through a site by updating an ajaxed ContentPlaceHolder.  I have a regular asp:Panel wrapping a ContentPlaceHolder as is suggested but I'm still getting a full postback.  The ajax seems to kick off and Loading Panels show up, but they disappear well before the content is updated in a full postback.

I originally tried using the NavigateURL attribute of the RadTreeNode but it wouldn't initiate any Ajax at all, so instead I am tying into the OnNodeClick event and doing a RadAjaxManager.Redirect() call from there.  Any thoughts on why the Master is still posting back instead of just the content?

<?xml version="1.0" encoding="utf-8" ?> 
<Tree > 
 <Node PostBack="false" Text="Project Data" > 
    <Node Text="SingleProject Data" Expanded="False" PostBack="false" > 
      <Node Text="Home" NavigateURL="#" Value="Home.aspx"></Node> 
      <Node PostBack="false" Text="Project Management" > 
        <Node Text="Configuration" NavigateURL="#" Value="Configuration.aspx"></Node> 
      </Node> 
      <Node PostBack="false" Text="Project Detail"> 
        <Node Text="Shipping" NavigateURL="#" Value="Shipping.aspx" /> 
        <Node Text="Building" NavigateURL="#" Value="Building.aspx" /> 
       </Node> 
    </Node> 
  </Node> 
</Tree> 
 
 
 protected void NodeClick(object sender, RadTreeNodeEventArgs e) 
        { 
            if (e.Node.NavigateUrl == "#") 
                RadAjaxManager1.Redirect(e.Node.Value); 
        } 
<form id="form1" runat="server"> 
    <telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True"> 
    </telerik:RadScriptManager> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> 
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadTreeView1"> 
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="pHeaderAjax" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    <telerik:AjaxUpdatedControl ControlID="pContentAjax" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 

Iana Tsolova
Telerik team
 answered on 05 May 2010
2 answers
75 views
Hi,
Can someone tell me how to change the background color of the RadGrid row when a user expands and the OnHierarchyExpanded Client event is fired?

Thanks.
Justin McMillen
Top achievements
Rank 1
 answered on 05 May 2010
8 answers
283 views
hello,

i have been using the trial of Prometheus in a few environments, most of the time deploying to my own webserver successfully. cool.

however, when i deploy my Web Application project to a commercial hosting company, www.WebHost4Life.com, i run into problems -- my RadControls dont work properly. i can see them, but none of the AJAX functionality seems to work.

for ex:

1) my RadGrids are wrapped in RadAjaxUpdatePanels, and locally that works. but on this hosting company's server the update panel does nothing -- the grid posts back on every operation.

2) RadComboBoxes dont render dropdown menus

3) GridNumericColumns dont validate input

...whats wrong? does it sound like the server doesnt have something installed, maybe the ASP.NET AJAX add-on? or something else maybe??


thanks!
matt
Fiko
Telerik team
 answered on 05 May 2010
4 answers
106 views

Hi,

I am writing a Telerik asp.net web site and having a problem I haven't seen before.

Start VS2008, open first aspx file. I can add Telerik controls. Switch to another aspx document attempt to add a Telerik control and a huge amount of mark up is inserted rather than the control (and does not function). Doesn't matter which aspx file I start with, when I switch to another one, I get the gibberish if I insert a control.

Could be unrelated: I recently "moved" my Documents folder to another drive.

This is a snippet of the load of text inserted rather than a valid control.

                    <soap-env:envelope soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <soap-env:body>
                            <a1:webcontroltoolboxitem id="ref-1" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/System.Web.UI.Design/System.Design%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db03f5f7f11d50a3a">
                                <locked>true</locked>
                                <filter href="#ref-5">
</filter>
                                <bitmap href="#ref-6">
</bitmap>
                                <assemblyname href="#ref-7">
</assemblyname>
                                <displayname id="ref-8">RadTextBox</displayname>
                                <dependentassemblies href="#ref-9">
</dependentassemblies>
                                <description id="ref-10">Telerik RadInput</description>
                                <typename id="ref-11">Telerik.Web.UI.RadTextBox</typename>
                                <company id="ref-12">Telerik</company>
                                <propertynames href="#ref-13">
</propertynames>
 
Kamen Bundev
Telerik team
 answered on 05 May 2010
2 answers
174 views
Ok, here's my problem (and I'm hoping that some of you grid guru's out there can help). I have a grid that performs some semi intensive calculations in the RowSelected event. This is fine for user clicked events & doesn't cause a performance issue. Where I run into trouble is when the user uses a shift click operation to select many rows (which is also valid). In this case I really only want to perform the action on the last row selected (the shift click target).

BUT... the RowSelected event fires once for every single row that becomes selected (which I suppose makes sense). Is there anyway to detect that the shift key was down on this / turn off / detect this type of row selection? It seems to cause a lot of unnecessary spinning of the wheels for me...

Thanks in advance!
-Brian
Brian Azzi
Top achievements
Rank 2
 answered on 05 May 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?