Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
204 views
Hello Telerik,

There are lots of threads about RadGrid inside RadDocks. I'd like to ask about the reverse - RadDocks inside RadGrid.

Please see below:

<telerik:RadDockLayout ID="RadDockLayout1" runat="server" EnableViewState="false">
                                  
    <telerik:RadGrid ID="RadGrid1" DataSourceID="" runat="server" AllowPaging="false"
        GridLines="None" PageSize="20">
        <MasterTableView TableLayout="Fixed">
            <Columns>
                <telerik:GridTemplateColumn DataField="GTC_Column">
                    <ItemTemplate>
                        <telerik:RadDockZone ID="RadDockZone1" runat="server" FitDocks="true" EnableViewState="false" Height="400px" Width="900px" Orientation="Horizontal" ToolTip="Zone1"></telerik:RadDockZone>                                                   
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true">
            <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True"
                AllowColumnResize="True"></Resizing>
            <ClientEvents OnGridCreated="onGridCreated" />
        </ClientSettings>
        <HeaderStyle Width="100px" />
    </telerik:RadGrid>
  
</telerik:RadDockLayout>

Will this work?

I want to populate the grid dynamically with cells of RadDockZones. The reason I want to use RadGrid is I want to be able to easily resize the RadDockZones that are in each cell in a RadGrid.

And when the RadDockZones are created, dynamic RadDocks will be created and placed in any of the created RadDockZones.

Different web controls (textboxes, labels, dropdowns, checkboxes) will be dynamically created in a RadDock.

Will the RadDocks (with its contents) then be able to move to any RadDockZone in the RadGrid?

The size of the RadDockZone will be dependent on the size of the cell in the RadGrid.

Finally, the state of the docks will be saved to a database.

When this state is retrieved from the database, the whole RadGrid with its RadDockZones and its RadDocks will be reconstructed.

Can anyone point me in the right direction? Is there any alternative to using RadGrid and still be able to easily resize cells that have RadDocks in them?

Thanks!
Virgil Rodriguez
Top achievements
Rank 1
 answered on 19 Jan 2012
0 answers
177 views
Hi,
I am building an asp.net 2.0 application referencing telerik ajax. The Telerik.Web.UI can not be resolved with following warning,

Warning    8    The primary reference "Telerik.Web.UI" could not be resolved because it has an indirect dependency on the framework assembly "System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "Telerik.Web.UI" or retarget your application to a framework version which contains "System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".

What should I do? Shall I replace Telerik.Web.UI with older version or something else?

Thanks,
York
york
Top achievements
Rank 1
 asked on 19 Jan 2012
2 answers
159 views
I'm having quite the issue trying to DataBind a bool? value to the Enabled property slider in a GridTemplateColumn of a Grid.
Here is my setup:
<telerik:RadGrid ID="_rgPermissions" runat="server" AutoGenerateColumns="False" HeaderStyle-Font-Bold="true"
                    AllowSorting="true" GridLines="None" Width="517px" Height="595px" Skin="Office2007"
                    OnNeedDataSource="_rgPermissions_NeedDataSource" OnItemDataBound="_rgPermissions_ItemDataBound"
                    Visible="false">
                    <AlternatingItemStyle BackColor="#f4f5f7" />
                    <GroupingSettings CaseSensitive="false" />
                    <MasterTableView>
                        <Columns>
                            <telerik:GridBoundColumn UniqueName="roleName" ItemStyle-Font-Size="X-Small" DataField="roleName"
                                HeaderText="Role">
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn UniqueName="SliderPermissions" HeaderText="Permissions"
                                ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="300px">
                                <ItemTemplate>
                                    <telerik:RadSlider runat="server" ID="_slPermissions" Orientation="Horizontal" Width="325px"
                                        Height="40" TrackPosition="Center" ItemType="Item" Skin="Windows7"
                                        OnClientBeforeValueChange="IsItemDisabledOnPermissionsSlider" >
                                        <Items>
                                            <telerik:RadSliderItem Text="None" Value="None" ToolTip="No permissions" runat="server">
                                            </telerik:RadSliderItem>
                                            <telerik:RadSliderItem Text="View" Value="View" Enabled='<%# Convert.ToString(DataBinder.Eval(Container, "DataItem.View_Static")).Equals("") ? true : !(bool)DataBinder.Eval(Container, "DataItem.View_Static") %>'
                                                ToolTip="Role can view folder and its contents" runat="server"></telerik:RadSliderItem>
                                            <telerik:RadSliderItem Text="Add" Value="Add" Enabled='<%# Convert.ToString(DataBinder.Eval(Container, "DataItem.Add_Static")).Equals("") ? true : !(bool)DataBinder.Eval(Container, "DataItem.Add_Static") %>'
                                                ToolTip="Role can upload files to folder or create new folders within" runat="server">
                                            </telerik:RadSliderItem>
                                            <telerik:RadSliderItem Text="Edit" Value="Edit" Enabled='<%# Convert.ToString(DataBinder.Eval(Container, "DataItem.Edit_Static")).Equals("") ? true : !(bool)DataBinder.Eval(Container, "DataItem.Edit_Static") %>'
                                                ToolTip="Role can edit folder and its contents" runat="server"></telerik:RadSliderItem>
                                            <telerik:RadSliderItem Text='Delete' Value="Delete" Enabled='<%# Convert.ToString(DataBinder.Eval(Container, "DataItem.Delete_Static")).Equals("") ? true : !(bool)DataBinder.Eval(Container, "DataItem.Delete_Static") %>'
                                                ToolTip="Role can delete folder and its contents" runat="server"></telerik:RadSliderItem>
                                        </Items>
                                    </telerik:RadSlider>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="View_Static" Visible="false" UniqueName="View_Static">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Add_Static" Visible="false" UniqueName="Add_Static">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Edit_Static" Visible="false" UniqueName="Edit_Static">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Delete_Static" Visible="false" UniqueName="Delete_Static">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn UniqueName="roleID" Visible="false" DataField="roleID" AllowSorting="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn UniqueName="parentMasterID" DataField="parentMasterID" Visible="false"
                                AllowSorting="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="FolderPermissionsID" Visible="false" UniqueName="FolderPermissionsID">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                    <HeaderStyle BorderColor="DarkGray" BorderStyle="Solid" BorderWidth="1px" />
</telerik:RadGrid>
 
<telerik:RadCodeBlock ID="_rcb" runat="server">
 
    <script type="text/javascript">
 
      function IsItemDisabledOnPermissionsSlider(sender, args) {
            if (!sender.get_items()[args.get_newValue()].get_enabled())
                args.set_cancel(true);
        }
 
    </script>
 
</telerik:RadCodeBlock>

This is not working at all. Every item in the slider still remains enabled. Note, while the "Static" bool's can be null, I tried this is with a bool value guaranteed not to be null using Enabled='<%# !(bool)DataBinder.Eval(Container, "DataItem.NormalBool") %>' , and it still doesn't work.
I even tried to do Text='<%# DataBinder.Eval(Container, "DataItem.SomeText") %>' and that didn't show up. Nothing seems to DataBind to the Sliders.

Any advice?
I know I can do all of this through the Grid's itemdatabound, but I'd prefer not to.
Stephen
Top achievements
Rank 1
 answered on 19 Jan 2012
1 answer
108 views
Hello,

I'm using a modal dialog which is a RadWindow. The page should present an alert using "radalert" if the user has not saved their work. When the save button is clicked a hidden field is updated "hdnIsModified". When the close button is clicked, the "ClosePage()" function is called which passes an argument to the calling page if the page has been modified. Before the page closes, "onBeforeWindowClose" is called to determine if the alert should be displayed.

The problem is that I'm getting an error message (Cant execute code from a freed script) if the user makes a change to a dropdown list inside the RadAjaxPanel, then clicks "save", then "Cancel". If the user does not change the dropdown list and only clicks "save", then "cancel", it works fine. The dropdown list causes an ajax request since it's inside the radajaxpanel. Any ideas why this could interfere with the RadAlert logic? The "Save" and "Cancel" buttons are not inside the RadAjaxPanel.


RadWindow as Modal:
function SavingChanges() {
    var hdn = document.getElementById('<%=hdnIsModified.ClientID %>');
    if (hdn) {
        hdn.value = 'true';
    }
}
 
function ClosePage() {
    var oModifications = document.getElementById('<%=hdnIsModified.ClientID %>');
    if (oModifications.value.toLowerCase() == "true") {
        GetRadWindow().close('reload');
    } else {
        GetRadWindow().close();
    }
}
 
function onBeforeWindowClose(oWinow, args) {
    function callbckFunction(confirmResult) {
        if (confirmResult) {// confirmResult == true
            // Close this RadWindow
            // First remove the handler in order to avoid recursion
            oWinow.remove_beforeClose(onBeforeWindowClose);
 
            oWinow.close();
             
            // Reattach the handles after the window is closed.
            // RECOMMENDATION: If the DestroyOnClose="true" property is set in in the RadWindow's declaration,
            // then remove this line of the code:
            oWinow.add_beforeClose(onBeforeWindowClose);
        }
    }
 
    // Close the window: If modifications exist, reload parent grid by passing argument
    var oModifications = document.getElementById('<%=hdnIsModified.ClientID %>');
    if (oModifications.value.toLowerCase() != "true") {
        // Cancel closing
        args.set_cancel(true);
 
        // Show a rad confirmation dialog
        var sMsg = "Are you sure you want to cancel " + document.getElementById('<%=Mode.ClientID %>').value.toLowerCase() + "ing" + " the new requirement?";
        radconfirm(sMsg, callbckFunction, 400, 150, null, "Confirm");
    }
 
 
}
 
function GetRadWindow() {
    var oWindow = null;
    if (window.radWindow)
        oWindow = window.radWindow;
    else if (window.frameElement.radWindow)
        oWindow = window.frameElement.radWindow;
    return oWindow;
}
 
function pageLoad() {
    // Get the RadWindoiw object that contains this page
    var oWindow = GetRadWindow();
 
    // Attach RadWindow's OnClientBeforeClose handler
    oWindow.add_beforeClose(onBeforeWindowClose);
}
 
function pageUnload() {
    // Get the RadWindoiw object that contains this page
    var oWindow = GetRadWindow();
 
    // NOTE! If the DestroyOnClose="true" is set in the RadWindow's declaration,
    // then the oWindow object will be 'null'.
    if (oWindow) {
        // Detach RadWindow's OnClientBeforeClose handler
        oWindow.remove_beforeClose(onBeforeWindowClose);
    }
}



<asp:Button ID="Save" runat="server"
     Text="Save" onclick="Save_Click" OnClientClick="SavingChanges();" />
 <input id="butCancel" type="button" value="Cancel" onclick="ClosePage();" />
 
<div style="margin-left: 15px; margin-right: 10px; margin-top: 8px; margin-bottom: 8px">
     <hr />
     <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" >
             <div ID="DataEntryArea" class="span-22 last" runat="server">
             </div>
     </telerik:RadAjaxPanel>
     <hr style="margin:0.5em 0 0 0" />
 </div>



Nathan
Top achievements
Rank 2
 answered on 18 Jan 2012
5 answers
76 views
I just upgraded to the latest version of the RadControls.

I upgraded through the Visual Studio 2010 Telerik menu.
The upgarde took it upon itself to modify the asp code.

Before the upgrade I had code like this...
<telerik:GridBoundColumn DataField="IC01Name" FilterControlWidth="40px"
    HeaderText="IC01 Name" SortExpression="IC01Name" UniqueName="IC01Name">
    <HeaderStyle Width="70px" />
</telerik:GridBoundColumn>

After the upgrade I had code like this....
<telerik:GridBoundColumn DataField="IC01 Name" FilterControlWidth="40px"
    HeaderText="IC01 Name" SortExpression="IC01 Name" UniqueName="IC01 Name">
    <HeaderStyle Width="70px" />
</telerik:GridBoundColumn>

Which resulted in lots of errors aboout Unique names not allowed to have spaces.....space I did not put there!!
Why did the upgrade making these changes?
I now have hours of testing and fixing to do!!!!
Smith
Top achievements
Rank 1
 answered on 18 Jan 2012
3 answers
265 views
My requirements are to have sorting, pagination and grouping of the data done on the server-side.  With advanced data-binding, and custom pagination, via the NeedDataSource event, I'm able to easily do the sorting on the entire dataset and use pagination information to slice the data to send to the client.  However the issue is how to deal with grouping on the server side so that the RadGrid can display it.

I've looked through the demos, tutorials, documentation, forum, etc. and haven't seen anything on it, so if I've missed something please let me know.  One reference I came across is in the "limitation" section of the http://www.telerik.com/help/aspnet/grid/grdbasicgrouping.html document.

Has anyone dealt with this issue, have any ideas or advice?


Chris
Top achievements
Rank 1
 answered on 18 Jan 2012
1 answer
240 views
Hi all,

Is it possible to combine the 2 features (Multi columns and Check box) out of the box? I do not want to use checkbox and hidden fields in the item templates of the combo box in order to manage the multi selection feature. Please find the attached snap shoot of what i'm trying to achieve.

If this is doable it will be great providing me with working sample.

Regards,
Taiseer
Cat Cheshire
Top achievements
Rank 1
 answered on 18 Jan 2012
2 answers
97 views
Hello,

I'm currently using the RadGrid control with a delete button I've added to the "CommandItemTemplate" section. When the user selects certain rows and clicks delete, a client side event is called "delete_click". This function iterates over each selected row to build up an array of parameters which should include the primary key of the row. I'm currently using hidden columns to hold certain values needed in this function. Certain values are IsUserAdmin, userRole, and userId - but none of these should be displayed as a column in the grid.The primary key (data key) is userId.... "<MasterTableView DataKeyNames='userId'>

Question #1: Is there a better approach for associating these values with a row instead of hidden columns? You can see in the example below, to access the row's column "IsUserAdmin", I access the column by it's unique name. This is a column in the grid that is hidden. Can I associate this without using a hidden column as a better approach? 

Below is an example of how I access the cells for each selected row. 

         var grid = $find("<%=grdSummary.ClientID %>");
         var MasterTable = grid.get_masterTableView();
         var selectedRows = MasterTable.get_selectedItems();
         var parms = new Array();
         for (var i = 0; i < selectedRows.length; i++) {
         {  
          var row = selectedRows[i];
           parm = new ScheduleSummaryParms();
           // Retrieve Cell by column
           parm.IsAdmin = MasterTable.getCellByColumnUniqueName(row, "userIsAdmin").innerHTML; 
           parm.userRole = MasterTable.getCellByColumnUniqueName(row, "userIsAdmin").innerHTML;        
          parms[i] = parm;
         }

Question #2: Is there a way to access the row's primary key. I've been thinking about adding a hidden column for the primary key, but I thought there had to be a better way. I've seen examples using "getDataKeyValue", but this doesnt seem to work. 

Thanks!!
Jayesh Goyani
Top achievements
Rank 2
 answered on 18 Jan 2012
1 answer
132 views
Hi,
   I have been trying to get this resolved. I have a grid with a GridCalculatedColumn, this column combines two Data fields and shows them together. I want to specify the Grid Sort Expression for this column in the grid so when the grid initially comes up its sorted by this column and the little sorting image in the column header is placed there to show the user the default column thats sorted. What should I put in the GridSortExpression's FieldName?  I can not seem to get this, It seems with a grid bound column the image appears since its a single datafield but how can I do the same thing with a grid calculated column *Updated* I actually have noticed the same issue with GridTemplateColumns as well, please let me know, thanks in advance!!

<SortExpressions>
       <telerik:GridSortExpression FieldName="OriginCity" />
 </SortExpressions>
  
  
 <telerik:GridCalculatedColumn UniqueName="Origin" HeaderText="Origin" AutoPostBackOnFilter="true"     
       SortExpression="{0} , {1}"
       DataFields="OriginCity, OriginState" Expression='{0} + " " + {1}'>
         <HeaderStyle HorizontalAlign="Left" VerticalAlign="Bottom" />
         <ItemStyle HorizontalAlign="Left" />
</telerik:GridCalculatedColumn>
Farhan
Top achievements
Rank 1
 answered on 18 Jan 2012
5 answers
550 views
How can I disable the upload button till a file is selected? I tried to set the upload enable=false then use

 

 

<telerik:radupload id="RadUpload1" OnClientFileSelected="ClientFileSelected"  runat="server" ControlObjectsVisibility="None"  text="BROWSE" targetfolder="uploads" ></telerik:radupload>

but not work

in javascript ClientFileSelected

 

I used below, not work
document.getElementById("Mygrid_ctl00_ctl04_btnUpload").disabled = true;

Thanks

Richard
Top achievements
Rank 1
 answered on 18 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?