Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
162 views
Hi All - I am using current build of aspjax controls. I have been having a real problem getting columns to line up in hierarchical self referencing grid. I have gone through all the other posts here that I could find to no avail... :


http://www.telerik.com/support/kb/aspnet-ajax/grid/aligning-columns-in-each-level-of-self-referencing-grid.aspx

http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/selfreferencing/defaultcs.aspx
http://www.telerik.com/community/forums/aspnet-ajax/grid/self-referencing-hierarchy-on-radgrid.aspx


however, I finally figured out a tweak that seems to work for me, so I thought I would post for everyone.

The symotom is that I get a graduated spacing as the columns move left, and which is differnt in scale as I go down in hierarchical level. I have attached example of problem.

To fix it, I have to pad the cells with different settings depending on where they fall in the grid. The code that seems to work for me is here:

 Public Sub Page_PreRenderComplete(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.PreRenderComplete
        HideExpandColumnRecursive(RadGrid1.MasterTableView)
    End Sub
    
    Public Sub HideExpandColumnRecursive(ByVal tableView As GridTableView)
        Dim nestedViewItems As GridItem() = tableView.GetItems(GridItemType.NestedView)
        For Each nestedViewItem As GridNestedViewItem In nestedViewItems
            nestedViewItem.HorizontalAlign = HorizontalAlign.Right
            For Each nestedView As GridTableView In nestedViewItem.NestedTableViews
                nestedView.HorizontalAlign = HorizontalAlign.Right
                nestedView.Style("border") = "0"
                nestedView.Style("padding-left") = "0px"
                nestedView.Style("padding-right") = "0px"
                Dim MyExpandCollapseButton As Button = DirectCast(nestedView.ParentItem.FindControl("MyExpandCollapseButton"), Button)
                If nestedView.Items.Count = 0 Then
                    If Not IsNothing(MyExpandCollapseButton) Then
                        MyExpandCollapseButton.Style("visibility") = "hidden"
                    End If
                    nestedViewItem.Visible = False
                Else
                    If Not IsNothing(MyExpandCollapseButton) Then
                        MyExpandCollapseButton.Style.Remove("visibility")
                    End If
                    
                     
                    'Need to set graduate padding for lower level to avoid V alignment problem
                    For Each item As GridItem In nestedView.Items
                        Dim level As Integer = item.ItemIndexHierarchical.Split(":"c).Length
                        If level = 2 Then
                            
                            Dim nPad As Integer = 0
                            For i As Integer = 2 To item.Cells.Count - 1  'ignore first col
                                If i < 6 Then
                                    nPad = 18
                                ElseIf i > 5 And i < 10 Then
                                    nPad = 12
                                Else
                                    nPad = 8
                                End If
                                item.Cells(i).Style("padding-right") = nPad & "px !important"
                            Next
                        End If
                        
                        If level = 3 Then
                            
                            Dim nPad As Integer = 0
                            For i As Integer = 2 To item.Cells.Count - 1  'ignore first col
                                If i < 6 Then
                                    nPad = 25
                                ElseIf i > 5 And i < 7 Then
                                    nPad = 20
                                ElseIf i > 6 And i < 10 Then
                                    nPad = 15
                                Else
                                    nPad = 10
                                End If
                                item.Cells(i).Style("padding-right") = nPad & "px !important"
                            Next
                        End If
                    Next
                   
                    
                    
                End If
 
                If nestedView.HasDetailTables Then
                    HideExpandColumnRecursive(nestedView)
                End If
            Next
        Next
    End Sub
Dimo
Telerik team
 answered on 20 Apr 2010
1 answer
318 views
I can't understand why my RadGrid doesn't work. Nothing triggers when i press delete, update! The Ajax image just comes up. And if i select a row the SelectColumn gets selected but triggers an Ajax update and the checkbox gets unchecked!

<%@ Page Language="C#" MasterPageFile="~/Page.Master" AutoEventWireup="true" CodeBehind="ManageUsers.aspx.cs" Inherits="Adeprimo.Tulo.Web.User.Administration.ManageUsers" Title="Untitled Page" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="ctpHead" runat="server"> 
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ctpMain" runat="server"> 
    <div id="Layout"> 
        <div class="typography"> 
            <h2><asp:Literal runat="server" ID="litLocalizationForgotPassword" Text="<%$ Resources:Default,User_ManageUsers%>" /></h2> 
        </div> 
    </div> 
    <div style="clear: both;"> 
        <telerik:RadAjaxManager ID="RadAjaxManager" runat="server"> 
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="rdgUsers"> 
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="rdgUsers" LoadingPanelID="RadAjaxLoadingPanel" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting>                                                   
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server" /> 
    </div> 
    <telerik:RadGrid ID="rdgUsers" runat="server" EnableEmbeddedSkins="true" Skin="Black" AllowSorting="true" AllowMultiRowSelection="true" 
        OnUpdateCommand="UpdateCommand" OnInsertCommand="InsertCommmand" OnDeleteCommand="DeleteCommand"> 
        <MasterTableView Width="100%" ShowHeadersWhenNoRecords="true" HorizontalAlign="NotSet" 
            ExpandCollapseColumn-Display="true" AutoGenerateColumns="False" 
            DataKeyNames="UserName" EditItemStyle-HorizontalAlign="Left" > 
            <Columns> 
                <telerik:GridClientSelectColumn UniqueName="column" /> 
                <telerik:GridBoundColumn DataField="UserName" HeaderText="User Name" UniqueName="UserName" /> 
                <telerik:GridTemplateColumn DataField="Email" UniqueName="Email" HeaderText="Email" Visible="true"> 
                    <ItemTemplate> 
                        <%#DataBinder.Eval(Container.DataItem, "Email")%> 
                    </ItemTemplate> 
                    <EditItemTemplate> 
                        <telerik:RadComboBox ID="rcbCoutry" runat="server" AppendDataBoundItems="true" DataTextField="Country" DataValueField="Country"> 
                            <Items> 
                                <telerik:RadComboBoxItem Text="Sverige" Value="0" Visible="false" /> 
                                <telerik:RadComboBoxItem Value="1" Text="Finland" /> 
                            </Items> 
                        </telerik:RadComboBox> 
                    </EditItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridBoundColumn DataField="IsApproved" HeaderText="Is Approved" UniqueName="IsApproved" /> 
                <telerik:GridBoundColumn DataField="LastLoginDate" HeaderText="Last Login" UniqueName="LastLoginDate" /> 
                 
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCustomer" 
                    EditText="Edit" ItemStyle-HorizontalAlign="Right"> 
                </telerik:GridEditCommandColumn> 
                <telerik:GridButtonColumn ConfirmText="Are you sure you wan't to delete this user?" ConfirmDialogType="RadWindow" 
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" 
                    UniqueName="DeleteColumn"> 
                </telerik:GridButtonColumn> 
            </Columns> 
            <EditFormSettings EditColumn-UpdateText="Uppdatera" EditFormType="AutoGenerated"> 
                <EditColumn ButtonType="PushButton" UpdateText="Update" EditText="Edit" 
                    EditFormColumnIndex="5" FooterStyle-BorderStyle="Solid" HeaderButtonType="PushButton" 
                    InsertText="Save" CancelText="Cancel"> 
                </EditColumn> 
            </EditFormSettings> 
            <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" PagerTextFormat="{4}Sida {0} av {1}, visar användare {2} av {3} av totalt {5}" 
                FirstPageToolTip="Första sidan" NextPageToolTip="Nästa sida" PrevPageToolTip="FöregÃ¥ende sida" 
                LastPageToolTip="Sista sidan"></PagerStyle> 
            <NoRecordsTemplate> 
                <div style="text-align: center; line-height: 25px;"> 
                    <strong>No Users Found!</strong> 
                </div> 
            </NoRecordsTemplate> 
        </MasterTableView> 
        <ClientSettings EnablePostBackOnRowClick="true" Selecting-AllowRowSelect="True"> 
            <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
</asp:Content> 


using System; 
using System.Web.Security; 
using Telerik.Web.UI; 
 
namespace Adeprimo.Tulo.Web.User.Administration 
{ 
    public partial class ManageUsers : System.Web.UI.Page 
    { 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            //Bind dgUsers with all Users 
            rdgUsers.DataSource = Membership.GetAllUsers(); 
            rdgUsers.DataBind(); 
        } 
        #region Add, Update, Delete Member 
        /// <summary> 
        /// Add new member 
        /// </summary> 
        /// <param name="source"></param> 
        /// <param name="e"></param> 
        protected void InsertCommmand(object source, GridCommandEventArgs e) 
        { 
        } 
        /// <summary> 
        /// Update member 
        /// </summary> 
        /// <param name="source"></param> 
        /// <param name="e"></param> 
        protected void UpdateCommand(object source, GridCommandEventArgs e) 
        { 
        } 
 
        /// <summary> 
        /// Delete member 
        /// </summary> 
        /// <param name="source"></param> 
        /// <param name="e"></param> 
        protected void DeleteCommand(object source, GridCommandEventArgs e) 
        { 
            GridEditableItem item = (GridEditableItem)e.Item; 
            Membership.DeleteUser(e.Item.OwnerTableView.Items[e.Item.ItemIndex]["UserName"].Text); 
        } 
        #endregion 
    } 
} 

Princy
Top achievements
Rank 2
 answered on 20 Apr 2010
3 answers
245 views
HI,
    I have textbox in one of the Radgrid Column.
I want to use tooltip for these textboxes. The tooltip has to show the corresponding Texbox values.
Let me know how to implement this?



Thank You.
Dimo
Telerik team
 answered on 20 Apr 2010
3 answers
509 views
Hi expert,

I have a Grid with some columns that allow filters. When the page is rendered for the first time, I hided all filters using this client side code :
function pageLoad(sender, args)
{
    $find('<%=Grid.ClientID %>').get_masterTableView().hideFilterItem();
}

for each column that allow filter, I want to show the filter on the click on this column. I use the ColumnClick event to do that, but I'm not able to do that. I want some client side code like :

function ColumnClick(columnName)
{
        var masterTable = $find('<%=Grid.ClientID %>').get_masterTableView();
        masterTable.get_columns()[columnName].AllowFiltering = true;
}

I know that I can do that using server side code, but I don't want to that.
I hope that you have some Javascript code to acheive my goal.

thank you for you help.

Hakim
Maria Ilieva
Telerik team
 answered on 20 Apr 2010
1 answer
116 views

Hello all,

I have one radgrid whose heigh is changed according to user machine resolution, this is done by invoking

<ClientEvents OnGridCreated="onGridCreated" /> 

Height is working properly, however when a row is selected, header row gives the appearance of moving by increasing and decreasing its width.

This is how columns are defined:

 <telerik:GridBoundColumn   
                                UniqueName="Subject"   
                                SortExpression="Subject" HeaderText="Subject" DataField="Subject" ItemStyle-Width="33%">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn   
                                UniqueName="EntityName"   
                                SortExpression="Displayname" HeaderText="Entity" DataField="Displayname" ItemStyle-Width="14%">  
                        </telerik:GridBoundColumn> 

able on which this grid is inserted has this style: 
style

 

="table-layout:fixed;"

 

and this is the javascript function:

 function onGridCreated(sender, args) {  
 
 
            try {  
                var scrollArea = sender.GridDataDiv;  
                var gridHeader = sender.GridHeaderDiv;  
                var ostage;  
                var vpaging;  
                var vmenu;  
                vpaging = 0;  
                vmenu = 20;  
 
                if (document.getElementById("ucPagingList_divPaginacion") != null)  
                    vpaging = 22;  
 
                if (scrollArea != null && gridHeader != null) {  
                    if (parent.document.getElementById("stage") != null) {  
                        ostage = parent.document.getElementById("stage").clientHeight;  
                        scrollArea.style.height = ostage - gridHeader.clientHeight - 25 - vpaging - vmenu  + "px";  
                    }  
                    else {  
                        scrollArea.style.height = screen.availHeight - gridHeader.clientHeight - vpaging - vmenu  + "px";  
                    }  
                }  
            }  
            catch (err) {  
            }  
 
        } 

any clue ?, tried a lot of possible actions with no result  ... :(

 

 

 
Thanks in advance


Dimo
Telerik team
 answered on 20 Apr 2010
1 answer
53 views
Hi,

I'm using a grid to both display records and allow users to edit them.  I'm using the Black skin.  When a user is viewing the grid the black background extends pretty wide but the individual records visually stop 1/3 of the way out.  And when you click on edit the area where the record is displayed is not nearly wide enough.  If everything would go out as wide as the black area on the grid it would look really good.  As it is the alternating backround for each record looks goofy when it stops 1/3 of the way across the black grid area and you can't even see the update/cancel buttons when you go to edit.  I also noticed that the add and refresh grid graphic doesn't display - the links are there and there's a gray box where the graphic should be but that's it.  Thought I'd sneak that one in there, too.

Thanx!

Eric
Dimo
Telerik team
 answered on 20 Apr 2010
1 answer
141 views
Hi,
 I am using radconfirm to put up a confirmation dialog. But it does not appear as a modal window in Internet Explorer. I am able to click the controls on the window behind the radconfirm dialog. The modal attribute in RadWindowManager is set to True.
 In Firefox it appears as a modal window.

Could you please let me know if any setting has to be made so that radconfirm appears modal in IE.

Thanks
Satyaprakash J


Georgi Tunev
Telerik team
 answered on 20 Apr 2010
1 answer
124 views
Greetings,
    When the following code is used to open a RadWindow, the window is not modal.  How can this be done?

<

 

input type="image" id="LoginButton" src="../../Content/Images/login.jpg" onclick="radopen('<%= Url.Action("Login", "Account") %>', 'RadWindow1'); return false;" />

Thanks in advance,
Eugene

 

Georgi Tunev
Telerik team
 answered on 20 Apr 2010
1 answer
302 views
Typically I use a Dataset object and store a table in Session for RadGrid's datasource.  I have been using Linq To Sql lately but I cannot figure out how to  use Linq for the datasourse in Session for the RadGrid....for example, how would I convert the following code to using Linq?

    Protected Sub radGridExperts_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles radGridExperts.NeedDataSource  
 
        If Not IsNothing(Session("Experts")) Then 
 
            radGridExperts.DataSource = CType(Session("Experts"), Case_Inquiry.Case_ExpertsDataTable)  
 
        Else 
 
            'do not fill anything, but create blank datasource  
            Dim dt As New Case_Inquiry.Case_ExpertsDataTable  
            Session("Experts") = dt  
            radGridExperts.DataSource = dt  
 
        End If 
 
    End Sub 

To make it simple, lets assume this is the linq Query.

Dim query = From c in db.Case_Experts _
        Select c.Id, c.Name

Also assume that I want to do updates/inserts/deletes to the data.

Appreciate any help, thank you.

Coty
Yavor
Telerik team
 answered on 20 Apr 2010
1 answer
98 views
Hi:
  In my current project, several appointments,single or recurring, need to be showed in the scheduler. When a recurring appointment is clicked, a confirm dialog will be showed. The title for it is "editing a recurring appointment". There are 2 radiobuttons on it, "edit the only occurrence" and "edit the series". It is good enough. However, i need to custimize the default text for the aforementioned ones. Can anyone inform me the potential solution?
Thanks.
Peter
Telerik team
 answered on 20 Apr 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?