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

I have followed the code provided in the self-referencing hierarchy demo (http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/selfreferencing/defaultcs.aspx) exactly, but I am having trouble with the columns in nested details table not lining correctly.

My radgrid looks like this

<style type="text/css">
    .RadGrid td
    {
        padding: 0;
    }
</style>
<telerik:RadGrid ID="rgTasks" runat="server" OnNeedDataSource="rgTasks_NeedDataSource"
      Skin="Hay"
      OnColumnCreated="RadGrid1_ColumnCreated"
        OnItemCreated="RadGrid1_ItemCreated" OnItemDataBound="RadGrid1_ItemDataBound">
    <MasterTableView CommandItemDisplay="None" DataKeyNames="TASK_UID, TASK_PARENT_UID"
        HierarchyDefaultExpanded="true" HierarchyLoadMode="Client">
        <SelfHierarchySettings ParentKeyName="TASK_PARENT_UID" KeyName="TASK_UID" />
        <NoRecordsTemplate></NoRecordsTemplate>
    </MasterTableView>
    <ClientSettings AllowExpandCollapse="true" />
</telerik:RadGrid>


However, as you can see from the screenshot, the columns are not aligning as they are in the demo. The code-behind is exactly as in the demo. The only difference is that I am running on .Net 3.5

Entire code behind code is here:
protected void Page_Load(object sender, EventArgs e)
        {
            rgTasks.MasterTableView.FilterExpression = "TASK_PARENT_UID IS NULL";
        }
  
        protected void RadGrid1_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);
                e.Column.ItemStyle.Wrap = false;
            }
        }        
  
        public void Page_PreRender(object sender, EventArgs e)
        {
            HideExpandColumnRecursive(rgTasks.MasterTableView);
        }
  
        public void HideExpandColumnRecursive(GridTableView tableView)
        {
            GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView);
            foreach (GridNestedViewItem nestedViewItem in nestedViewItems)
            {
                foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)
                {
                    nestedView.Style["border"] = "0";
  
                    Button MyExpandCollapseButton = (Button)nestedView.ParentItem.FindControl("MyExpandCollapseButton");
                    if (nestedView.Items.Count == 0)
                    {
                        if (MyExpandCollapseButton != null)
                        {
                            MyExpandCollapseButton.Style["visibility"] = "hidden";
                        }
                        nestedViewItem.Visible = false;
                    }
                    else
                    {
                        if (MyExpandCollapseButton != null)
                        {
                            MyExpandCollapseButton.Style.Remove("visibility");
                        }
                    }
  
                    if (nestedView.HasDetailTables)
                    {
                        HideExpandColumnRecursive(nestedView);
                    }
                }
            }
        }
  
        protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
        {
            CreateExpandCollapseButton(e.Item, "TASK_UID");
  
            if (e.Item is GridHeaderItem && e.Item.OwnerTableView != rgTasks.MasterTableView)
            {
                e.Item.Style["display"] = "none";
            }
  
            if (e.Item is GridNestedViewItem)
            {
                e.Item.Cells[0].Visible = false;
            }
        }
  
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            CreateExpandCollapseButton(e.Item, "TASK_UID");
        }
  
        public void CreateExpandCollapseButton(GridItem item, string columnUniqueName)
        {
            if (item is GridDataItem)
            {
                if (item.FindControl("MyExpandCollapseButton") == null)
                {
                    Button button = new Button();
                    button.Click += new EventHandler(button_Click);
                    button.CommandName = "ExpandCollapse";
                    button.CssClass = (item.Expanded) ? "rgCollapse" : "rgExpand";
                    button.ID = "MyExpandCollapseButton";
  
                    if (item.OwnerTableView.HierarchyLoadMode == GridChildLoadMode.Client)
                    {
                        string script = String.Format(@"$find(""{0}"")._toggleExpand(this, event); return false;", item.Parent.Parent.ClientID);
  
                        button.OnClientClick = script;
                    }
  
                    int level = item.ItemIndexHierarchical.Split(':').Length - 1;
  
                    button.Style["margin-left"] = level * 15 + "px";
  
                    TableCell cell = ((GridDataItem)item)[columnUniqueName];
                    cell.Controls.Add(button);
                    cell.Controls.Add(new LiteralControl(" "));
                    cell.Controls.Add(new LiteralControl(((GridDataItem)item).GetDataKeyValue(columnUniqueName).ToString()));
                }
            }
        }
  
        void button_Click(object sender, EventArgs e)
        {
            ((Button)sender).CssClass = (((Button)sender).CssClass == "rgExpand") ? "rgCollapse" : "rgExpand";
        }

Ignatiuz
Top achievements
Rank 1
 answered on 18 Jul 2012
6 answers
156 views
Hi, I try to do the same thing that in the screenshoots.
The software on the right scale the scheduler view in the windows.

I'm looking to do the same with RadScheduler.

sorry for my bad english :)
Princy
Top achievements
Rank 2
 answered on 18 Jul 2012
2 answers
158 views
I am transitioning code from Microsoft's GridView to Telerik's RadGrid.  One thing I'm stuck on is how to add a Tooltip to a particular cell.   did find this article but the advice therein is not working for me: http://www.telerik.com/community/forums/aspnet/grid/radgrid-tooltip-on-cell.aspx

Here's the crux of the code I'm using:

protected void radGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
      if (e.Item is GridDataItem)
      {
        GridDataItem item = (GridDataItem)e.Item;
        item.Cells[1].ToolTip = "Sample Tooltip";


But, as I said above, no tooltip appears.  What should I do instead?

Robert
Robert
Top achievements
Rank 1
 answered on 17 Jul 2012
2 answers
72 views
Hello, I just updated the Telerik controls to version 2012.2.607.35 and it seems that the ability to transfer items between radcomboboxes has changed. I have two radcomboboxes, one with all possible choices and the other with previously selected choices which are loaded during Page_Load. I can add and remove new items to the list of previously selected items, but I am now unable to transfer existing items (added during the Page_Load event) out of it. This had been working prior to installing the new version. If I add a delete button I am able to remove them. I have verified that this isn't caused by any changes I made by updating the Telerik controls in an old project that uses this same structure and recompiling with no other changes, the functionality is then lost.

Can this be fixed, or is there a way I can work around it?

Thanks,
John
John Mann
Top achievements
Rank 1
 answered on 17 Jul 2012
5 answers
155 views
Hi 
I am having some issue with rad date picker
for all the clients it is working fine but on one customer machine windows 7 64 bit german OS on IE 9 (32 bit,64 bit )
it becomes tranparent ( screen shots attached )

by changing one property vai developrs Tool it is working fine  ( screen shots attached )
please see the attched document  and suggest what should i do 

1. Is there any changes taht can be done on client machine so that it will work
2.or this can be changed from server code
Maria Ilieva
Telerik team
 answered on 17 Jul 2012
1 answer
449 views

Radgrid edit mode rocks with a special formtemplate, it this might be simple but cannot figure out.  I need to be able to postback while in edit mode, i have 2 dropdownlists and need the second to be filled by the first while in edit mode. I can fill them to existing values but if a user need to change them they stay with existing values and don't change becuase of no postback.  So basically if they pick another make I need the models to refresh themselves based on the make.  If this is not possible in edit mode I will take it out to a panel and do it here.


Protected Sub myRadGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles myRadGrid.ItemDataBound
       If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then
           Dim editedItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
           Dim Loc As DropDownList = DirectCast(editedItem.FindControl("ddlLocation"), DropDownList)
           Dim make As DropDownList = DirectCast(editedItem.FindControl("ddlMake"), DropDownList)
           Dim model As DropDownList = DirectCast(editedItem.FindControl("ddlModel"), DropDownList)
           'Get the Location filled
           sql = "Select intDurableId, strLocation from Drat_J6DurableInfo Order by strLocation"
           Loc.Items.Add(New ListItem("Pick Location", "0"))
           buildDD(sql, Loc)
           Loc.SelectedValue = DirectCast(DataBinder.Eval(e.Item.DataItem, "intDurableId").ToString(), String)
           Loc.DataBind()
           'Get the make of the item
           sql = "Select intmakeId, strmake from Drat_Make order by strmake"
           make.Items.Add(New ListItem("Pick Make", "0"))
           buildDD(sql, make)
           make.SelectedValue = DirectCast(DataBinder.Eval(e.Item.DataItem, "intMakeId").ToString(), String)
           make.DataBind()
           'Get the Model of the item
           sql = "Select intModelId, strModel from Drat_Model order by strModel"
           model.Items.Add(New ListItem("Pick Model", "0"))
           buildDD(sql, model)
           model.SelectedValue = DirectCast(DataBinder.Eval(e.Item.DataItem, "intModelId").ToString(), String)
           model.DataBind()
       End If
   End Sub
Jayesh Goyani
Top achievements
Rank 2
 answered on 17 Jul 2012
1 answer
171 views
I have a control that will house several asp:ImageButtons that are separate from my control that holds the RadImageEditor. But both controls are on the same page.

I'm wanting to use an onclick function to load whatever type of thumbnail image is displayed inside the ImageButton to send it's url to my RadImageEditor to display inside the control there.

I'm not sure how to communicate between them since they are both on different ascx.cs pages.

How do I communicate from my asp:ImageButton id="imgTopImage"  to my RadImageEditor id="RadImageEditor1" ?

Click Function thus far. . .
public void ImageButton_Click(object sender, ImageClickEventArgs e)
{
    string imageUrl = imgTopImage.ImageUrl.ToString();
   // RadImageEditor1.ImageUrl = (imageUrl); //This is how easy I would like for it to be :)
}

Geoff
Top achievements
Rank 1
 answered on 17 Jul 2012
2 answers
193 views
All,
I am using the latest RadGrid control. I am seeing an unusual error when "Inserting" a row. The error occurs when the grid's "insert" button is clicked. The Error: Sys.WebForms.PageRequestManagerServerErrorException: Cannot find cell bound to column with unique name 'EditCommandColumn'. However, 'EditCommandColumn' is clearly the first column in the grid! This is happening no matter which EditMode I choose...
What am I missing here please?!
<telerik:RadAjaxPanel ID="apnlPayments" runat="server" LoadingPanelID="ajaxLoadingPanel" Width="100%" Height="348px">
    <h2 style="text-align:center">Loan Payments Editor</h2>
    <div style="width: 100%; height: 340px; padding: 3,5,3,15;">
        <telerik:RadGrid ID="gridPayments" runat="server"
            AutoGenerateColumns="false" ShowFooter="true" CellSpacing="0" CellPadding="0" 
            GridLines="Both" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px"
             
            Skin="Hay"
            ActiveItemStyle-CssClass="Row2" ItemStyle-CssClass="Row0" AlternatingItemStyle-CssClass="Row1"
             
            OnItemDataBound="grid_ItemDataBound" OnNeedDataSource="grid_NeedDataSource"
            OnInsertCommand="gridPayments_InsertCommmand" OnUpdateCommand="gridPayments_UpdateCommand"
            OnDeleteCommand="gridPayments_DeleteCommand" OnPreRender="gridPayments_PreRender">
             
            <ClientSettings>
                <Selecting EnableDragToSelectRows="false" AllowRowSelect="true" />
                <Scrolling AllowScroll="true" UseStaticHeaders="false" ScrollHeight="280px" FrozenColumnsCount="2" />
            </ClientSettings>
            <MasterTableView AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowPaging="false"
                DataKeyNames="LoanPaymentID" ClientDataKeyNames="LoanPaymentID" GridLines="Both" CommandItemDisplay="Bottom"
                EditMode="EditForms" EditFormSettings-EditFormType="AutoGenerated" >
                <CommandItemSettings ShowRefreshButton="false" ShowAddNewRecordButton="true" AddNewRecordText="" AddNewRecordImageUrl="~/Images/add_16.png" />
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" Visible="true">
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" Width="50px" />
                    </telerik:GridEditCommandColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmDialogType="RadWindow" ConfirmText="Delete this Payment?" ConfirmTitle="Delete" ImageUrl="~/Images/icon_delete.png" Reorderable="false" ShowSortIcon="false" Text="Delete" UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" Width="50px" />
                    </telerik:GridButtonColumn>
 
                    <telerik:GridBoundColumn DataField="LoanPaymentPS_ACCT_NO" FilterControlAltText="Filter LoanPaymentPS_ACCT_NO column" HeaderStyle-Wrap="false" HeaderText="PS ACCT NO" MaxLength="50" ReadOnly="true" SortExpression="LoanPaymentPS_ACCT_NO" UniqueName="PS_ACCT_NO" Visible="false" />
                    <telerik:GridDateTimeColumn DataField="LoanPaymentDateDue" DataFormatString="{0:MM/dd/yyyy}" FilterControlAltText="Filter LoanPaymentDateDue column" HeaderStyle-Wrap="false" HeaderText="DATE DUE" ReadOnly="true" SortExpression="LoanPaymentDateDue" UniqueName="LoanPaymentDateDue" Visible="false" />
                    <telerik:GridDateTimeColumn DataField="LoanPaymentDatePaid" DataFormatString="{0:MM/dd/yyyy}" DataType="System.DateTime" EmptyDataText="01/01/1900" FilterControlAltText="Filter LoanPaymentDatePaid column" HeaderStyle-Wrap="false" HeaderText="DATE PAID" SortExpression="LoanPaymentDatePaid" UniqueName="LoanPaymentDatePaid" />
                    <telerik:GridNumericColumn DataField="LoanPaymentAmount" DataType="System.Decimal" FilterControlAltText="Filter LoanPaymentAmount column" HeaderStyle-Wrap="false" HeaderText="AMOUNT" NumericType="Currency" SortExpression="LoanPaymentAmount" UniqueName="LoanPaymentAmount" ConvertEmptyStringToNull="false" />
                    <telerik:GridBoundColumn DataField="LoanPaymentDescription" FilterControlAltText="Filter LoanPaymentDescription column" HeaderStyle-Wrap="false" HeaderText="DESCRIPTION" MaxLength="50" SortExpression="LoanPaymentDescription" UniqueName="LoanPaymentDescription" Visible="false" />
                    <telerik:GridBoundColumn DataField="LoanPaymentUserReference" FilterControlAltText="Filter LoanPaymentUserReference column" HeaderStyle-Wrap="false" HeaderText="USER REFERENCE" MaxLength="50" SortExpression="LoanPaymentUserReference" UniqueName="LoanPaymentUserReference" Visible="false" />
                    <telerik:GridBoundColumn DataField="LoanPaymentMethodNo" FilterControlAltText="Filter LoanPaymentMethodNo column" HeaderStyle-Wrap="false" HeaderText="METHOD NO" MaxLength="50" SortExpression="LoanPaymentMethodNo" UniqueName="LoanPaymentMethodNo" Visible="false" />
                    <telerik:GridBoundColumn DataField="LoanPaymentMethodReference" FilterControlAltText="Filter LoanPaymentMethodReference column" HeaderStyle-Wrap="false" HeaderText="METHOD REFERENCE" MaxLength="50" SortExpression="LoanPaymentMethodReference" UniqueName="LoanPaymentMethodReference" Visible="false" />
                    <telerik:GridBoundColumn DataField="LoanPaymentType" FilterControlAltText="Filter LoanPaymentType column" HeaderStyle-Wrap="false" HeaderText="TYPE" MaxLength="50" SortExpression="LoanPaymentType" UniqueName="LoanPaymentType" Visible="false" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>                               
    </div>
</telerik:RadAjaxPanel>

Sayle
Top achievements
Rank 1
 answered on 17 Jul 2012
1 answer
47 views
Hello,  i'm not sure if the fileexplorere can do this. I want to give my users the option to copy a file locally as opposed to having to open the file and do a save as.   Sort of like when right click on a link to a pdf and choose "save target as".  Is there the option to enable this functionality in FileViewer?


Vessy
Telerik team
 answered on 17 Jul 2012
1 answer
165 views
I have a file explorer control which picks up files from a shared location. I want the default view to be set on a particular directory but I want the user to be able to move up and down the entire directory structure on my computer.Is it possible to do that?
Vessy
Telerik team
 answered on 17 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?