Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
86 views
Hi,

According to the documentation, OnColumnResizing should be passed a column index and a width
(http://www.telerik.com/help/aspnet-ajax/grid_oncolumnresizing.html)

However, the example provided uses sender and eventArgs, and the example demonstrates how to find the current width of the column, not the new value that should be assigned.  How do I get the new width?

Thanks,
Brad
Sebastian
Telerik team
 answered on 26 Jul 2010
1 answer
125 views
I have created a usercontrol for the grid.  I am having an issue where if you select a column to order by (click the heading), after the postbakc no rowclick, contextMenu and header contextMenu will work.  However if you sort again, they do.  So on every other postback the menu will work.

I have read on another forumk about adding the id of the contextMenu to the radajaxproxymanager, however the header contextMenu has no ID, also the rowclick also has no id as it is part of the grid.  My code is below,

<telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="progressLoader">
 
 
        <telerik:RadGrid ID="RadGrid1" 
                         runat="server"
                         GridLines="Vertical"                       
                         AllowSorting="true"
                         AllowPaging="true"
                         AllowCustomPaging="false"
                         AutoGenerateColumns="false"
                         EnableHeaderContextMenu="true"                       
                         Skin="Default"
                         PageSize="15"
                         OnNeedDataSource="RadGrid1_NeedDataSource"
             
                          >           
            <ExportSettings>
                <Pdf FontType="Subset" PaperSize="A4" />
                <Excel Format="Html" />
                <Csv ColumnDelimiter="Comma" RowDelimiter="NewLine" />
            </ExportSettings>
            <MasterTableView CommandItemDisplay="Top"  PagerStyle-AlwaysVisible="False" > 
                <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>         
               <CommandItemTemplate>
 
                      <asp:LinkButton ID="btn_save" runat="server" CommandName="saveGrid" ><asp:Image runat="server" ID="img_save" ImageUrl="~/_resources/images/icons/tick.png"/></asp:LinkButton>
                      <asp:LinkButton ID="btn_excel" runat="server" CommandName="excel" ><asp:Image runat="server" ID="Image1" ImageUrl="~/_resources/images/icons/xls_grey.gif"/></asp:LinkButton>                       
                     
                </CommandItemTemplate>
            </MasterTableView>
            <ClientSettings ReorderColumnsOnClient="True"
                            AllowDragToGroup="True"
                            AllowColumnsReorder="True"
                            EnablePostBackOnRowClick="False"
                            AllowGroupExpandCollapse="True" >
                            <Selecting AllowRowSelect="true" />
                             
                <Resizing AllowRowResize="True"
                          AllowColumnResize="True"
                          EnableRealTimeResize="True"
                          ResizeGridOnColumnResize="False">
                </Resizing>              
            </ClientSettings>
        </telerik:RadGrid>
 
</telerik:RadAjaxPanel>
Public Property Datasource() As DataTable
       Get
           Return _Datasource
       End Get
       Set(ByVal value As DataTable)
           _Datasource = value
       End Set
   End Property
 
   Public Property GridDataKeyNames() As String
       Get
           Return _GridDataKeyNames
       End Get
       Set(ByVal value As String)
           _GridDataKeyNames = value
       End Set
   End Property
 
   Public Property GridContextMenu() As Boolean
       Get
           Return _GridContextMenu
       End Get
       Set(ByVal value As Boolean)
           _GridContextMenu = value
       End Set
   End Property
 
   Public Property GridRowClick() As Boolean
       Get
           Return _GridRowClick
       End Get
       Set(ByVal value As Boolean)
           _GridRowClick = value
       End Set
   End Property
 
   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
       If Not IsPostBack Then          
           ViewState("gridData") = sectionCache
           ViewState("GridDataKeyNames") = GridDataKeyNames
           ViewState("GridContextMenu") = GridContextMenu
           ViewState("GridRowClick") = GridRowClick
       Else
           sectionCache = ViewState("gridData")
           GridDataKeyNames = ViewState("GridDataKeyNames")
           GridContextMenu = ViewState("GridContextMenu")
           GridRowClick = ViewState("GridRowClick")
       End If
 
       If Not Cache(sectionCache) Is Nothing Then
           Datasource = Cache(sectionCache)
       Else
           Cache(sectionCache) = Datasource
       End If
 
       standardGrid()
 
       If Not IsPostBack Then
 
           Dim hdn_field As HiddenField = TryCast(Page.Master.FindControl("hdn_pageId"), HiddenField)
 
           dataGrid = New DataRadGrid
           dataGrid.pageId = New Guid(hdn_field.Value.ToString())
           dataGrid.coreEntityId = Session.Item("RealId")
           Dim gridSettings As String = dataGrid.LoadSettings()
 
           If gridSettings <> "" Then
               Dim LoadPersister As New GridSettingsPersister(RadGrid1)
               LoadPersister.LoadSettings(gridSettings)
           End If
 
       End If
 
   End Sub
 
   Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
       RadGrid1.MasterTableView.VirtualItemCount = Datasource.Rows.Count
       RadGrid1.DataSource = Datasource
 
   End Sub
 
Protected Sub standardGrid()
 
       If GridRowClick Then
 
           If GridDataKeyNames = "" Then
               GridDataKeyNames = "ROWCLICK"
           Else
               GridDataKeyNames += ",ROWCLICK"
           End If
 
           RadGrid1.ClientSettings.ClientEvents.OnRowClick = "RowClick"
 
       End If
 
       If GridDataKeyNames <> "" Then
           Dim dataKeyNamesArray() As String = GridDataKeyNames.Split(",".ToArray())
 
           RadGrid1.MasterTableView.ClientDataKeyNames = dataKeyNamesArray
           RadGrid1.MasterTableView.DataKeyNames = dataKeyNamesArray
 
       End If
 
       If GridContextMenu Then
           RadGrid1.ClientSettings.ClientEvents.OnRowContextMenu = "RowContextMenu"
       End If
 
       Dim boundColumn As GridBoundColumn
 
       RadGrid1.MasterTableView.Columns.Clear()
 
       For Each column As DataColumn In Datasource.Columns
 
           If GridDataKeyNames <> "" Then
               If Not GridDataKeyNames.Contains(column.ColumnName.ToString()) Then
                   If column.ColumnName.ToString().IndexOf("_HIDDEN") < 0 Then
 
                       boundColumn = New GridBoundColumn
                       RadGrid1.MasterTableView.Columns.Add(boundColumn)
 
                       boundColumn.DataField = column.ColumnName
                       boundColumn.HeaderText = column.ColumnName.Replace("_", " ")
                       boundColumn.DataFormatString = "<nobr>{0}</nobr>"
                   Else
                       boundColumn = New GridBoundColumn
                       RadGrid1.MasterTableView.Columns.Add(boundColumn)
 
                       boundColumn.DataField = column.ColumnName
                       boundColumn.HeaderText = column.ColumnName
 
                       boundColumn.Visible = False
                   End If
 
               End If
           Else
               If column.ColumnName.ToString().IndexOf("_HIDDEN") < 0 Then
 
                   boundColumn = New GridBoundColumn
                   RadGrid1.MasterTableView.Columns.Add(boundColumn)
 
                   boundColumn.DataField = column.ColumnName
                   boundColumn.HeaderText = column.ColumnName.Replace("_", " ")
                   boundColumn.DataFormatString = "<nobr>{0}</nobr>"
               Else
                   boundColumn = New GridBoundColumn
                   RadGrid1.MasterTableView.Columns.Add(boundColumn)
 
                   boundColumn.DataField = column.ColumnName
                   boundColumn.HeaderText = column.ColumnName
 
                   boundColumn.Visible = False
               End If
           End If
 
 
       Next
 
   End Sub

Any help would be much appreciated
mabs
Top achievements
Rank 1
 answered on 26 Jul 2010
1 answer
101 views
In our application, we gave user options to store the grid settings to user. We were using 2009 Q2 Telerik RADGrid. Now that we upgraded the RADGrid to Q3, the grid settings gives error. We soon figured out that may be GridSettings are not compatiable. The end user doesn't wish to lose the already stored settings. Is there any utility or code to covert the old settings to new settings compatiable to newer RADGrid?
Maria Ilieva
Telerik team
 answered on 26 Jul 2010
6 answers
165 views
Is there any way of setting something in web.config or IIS (or anywhere) to fool FileExplorer into thinking that a file path "c:/aaa/fff" is "~/fff" so as to avoid using a custom provider?

John
Petio Petkov
Telerik team
 answered on 26 Jul 2010
5 answers
99 views
Our website needs to use:

<xhtmlConformance mode="Legacy" />

in the system.web section of our web config file.

I was not able to get the AjaxPanel to work when this is on.  Setting it to "transitional" or "strict" cause the panel to work nicely.  Unfortunately, changing this seetting at this time is not a choice for us.  Is the another way to make this work?

Maria Ilieva
Telerik team
 answered on 26 Jul 2010
4 answers
310 views
Good Day All

I have the following defination of a toolbar

               <telerik:RadToolBar runat="server" ID="RadToolBar1" style="overflow:visible;"
                        Skin="Telerik" Width="994px" Height="121px"
                        onbuttonclick="RadToolBar1_ButtonClick">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
            <Items>
             <telerik:RadToolBarButton>
                    <ItemTemplate>
                      
                        <div style="padding-left:30px">
                        <asp:Image ID="imgo" ImageUrl="~/images/Picture3.png" runat="server" />
                        <asp:Image ID="imgMore" ImageUrl="~/images/Picture5.png" runat="server" />
                        <asp:TextBox ID="txtSearch" Width="500px"  Height="40px" runat="server" />
                        <asp:ImageButton ID="btnCancel" runat="server" ImageUrl="~/images/Picture11.png" Text="Cancel" />
                          <asp:ImageButton ID="btnSearch" runat="server" OnClick="btnSearch_Click" Text="Search" ImageUrl="~/images/Picture12.png" />  
                        <telerik:RadToolBarButton runat="server" IsSeparator="true"></telerik:RadToolBarButton>
                        <asp:ImageButton ID="btnAttach" runat="server" ImageUrl="~/images/Picture13.png" Text="Add" />
                        <asp:ImageButton ID="btnAdd" runat="server" ImageUrl="~/images/Picture8.png" Text="Add" />
                        <asp:ImageButton ID="btnconfig" runat="server" ImageUrl="~/images/Picture9.png" Text="Config" />
                        <asp:ImageButton ID="btnCommitChanges" runat="server" ImageUrl="~/images/Save All 2.png" Text="Config" />
                        <telerik:GridTextBoxColumnEditor ID="textboxc" runat="server"></telerik:GridTextBoxColumnEditor>
                        
             
                       </div>                     
                    </ItemTemplate>
                </telerik:RadToolBarButton>
  
            </Items>
        </telerik:RadToolBar>

and i want to retrieve the value of a textbox control name txtsearch  that is inside the item template, i have tried to retrieve it like this
TextBox txtseach = new TextBox();
 
txtseach =  (TextBox)Page.FindControl("txtSearch");
but my txtseach comes back as null , while i have entered a value


Thanks

Vuyiswa
Top achievements
Rank 2
 answered on 26 Jul 2010
2 answers
146 views
Dear Telerik,

I am having the RadGrid which is also having child details showing through hierarchical method of grid. I have the following doubts to Export the grid into Excel.

* Need to export the parent grid and hierarchical or child details only if it is expanded.
* I would like to show only the datas means columns and rows of parent and child rather than displaying the items like   filter,expand/collapse, add/referesh/edit buttons etc.
* I used the follwing block of code to export excel. But it seems i am not not getting the proper positin of the columns means columns showing right side and rows are showing left side of the excel sheet. It is also exporting all of the child rows from the grid eventhough i am not expanding all of them.
private void ConfigureExcelExport()
    {
        //ExportExcel configuration settings
        //rgPostingBill.MasterTableView.Caption = "PostingNotice Billing Report";
        RadGrid1.ExportSettings.FileName = "PostingNotice";
        RadGrid1.ExportSettings.IgnorePaging = true;
        //RadGrid1.ExportSettings.HideStructureColumns = true;
        RadGrid1.MasterTableView.HierarchyDefaultExpanded = true;   
        RadGrid1.ExportSettings.ExportOnlyData = true;           
        RadGrid1.ExportSettings.OpenInNewWindow = true;
    }
 protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (isExcelExport)
        {
            if (e.Item is GridNoRecordsItem)
                e.Item.Visible = false;
  
            if (e.Item is GridCommandItem)
                e.Item.Visible = false;
  
            //if (e.Item is GridNestedViewItem)
            //    e.Item.Cells[0].Visible = false;
  
            //if (e.Item is GridDataItem)
            //{
            //    GridDataItem item = e.Item as GridDataItem;
            //    foreach (GridColumn col in e.Item.OwnerTableView.RenderColumns)
            //        if (!(col is GridBoundColumn))
            //            item[col.UniqueName].Visible = false;
            //}
        }
    }


Hope my above code and scenario is understandable.If so please let me know the possibilites.

-Thanks in Advance

Daniel
Telerik team
 answered on 26 Jul 2010
2 answers
119 views
My question is i have one check box .and one rad grid with combo box.(with value .P for present,A for absent ,L for leave)
when i checked check box that time  each combo box of rad grid have selected value should be 'P'
so.. how i can change  selection of all combos of rad grid on check box changed event.
rock
Top achievements
Rank 1
 answered on 26 Jul 2010
3 answers
345 views
Hi,

Can radgrit have more than 1 GridEditCommandColumn?

I already have 1 GridEditCommandColumn where I would display a sub section when clicked. But I need another GridEditCommandColumn because I have to have another sub section to display.

So for my radGrid, the GridEditCommandColumn A will show section A, and GridEditCommandColumn B will show section B.

However, I get an error when I put two GridEditCommandColumn. Is there a work around for this?


Please see attached pic for the example scenario.
Radoslav
Telerik team
 answered on 26 Jul 2010
2 answers
98 views

Hi.

I'm have RadGrid with 2 DropDownColumns. Then  i need third column with value, contains concatenated text-field(not value-field) from first 2 dropdown columns. How I can do it?

yerlan
Top achievements
Rank 1
 answered on 26 Jul 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?