Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
118 views
Hello,

I'm using in my websites the RadGrid control alot (See the following code - only DataKeyNames, AddNewRecordText properties and the columns are different).
Can I save this template on an external file and load it in each time I want to use the control?
<telerik:RadGrid ID="MngRadGrid" runat="server" GridLines="None" AllowPaging="True" CssClass="RadGrid" OnItemDataBound="MngRadGrid_ItemDataBound"
                AllowSorting="True" AutoGenerateColumns="False" ShowStatusBar="true" OnPreRender="MngRadGrid_PreRender"
                OnNeedDataSource="MngRadGrid_NeedDataSource" OnUpdateCommand="MngRadGrid_UpdateCommand"
                OnInsertCommand="MngRadGrid_InsertCommand" OnDeleteCommand="MngRadGrid_DeleteCommand" Width="780px">
            <MasterTableView Width="780px" CommandItemDisplay="Top" Dir="LTR" DataKeyNames="UserID">
            <AlternatingItemStyle HorizontalAlign="Left" VerticalAlign="Top" />
            <CommandItemSettings RefreshText="Refresh" AddNewRecordText="Add New Record" />
            <ItemStyle VerticalAlign="Top" HorizontalAlign="Left" />
            <HeaderStyle HorizontalAlign="Left" />
            <Columns>
                <telerik:GridEditCommandColumn EditText="<%$ Resources:TelerikResource, RadGridEditColumnText %>" ItemStyle-Width="7%" UniqueName="EditCommandColumn1" >
                </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn UniqueName="UserID" HeaderText="User ID" ItemStyle-Width="7%" DataField="UserID">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="UserName" HeaderText="<%$ Resources:MngResource, MngRLUsersMngRadGridColumnsUserName %>" ItemStyle-Width="19%" >
                  <ItemTemplate>
                      <asp:Image ID="AvatarImage" ImageUrl='<%# "~/RL/Avatars/" + Eval("Avtr") %>' Width="40px" Height="40px" runat="server" /><br />
                      <asp:Label ID="ManagerNameDataLabel" SkinID="NormalText" runat="server" Text='<%# Eval("UserName") %>'></asp:Label>
                  </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="RolesNam" HeaderText="<%$ Resources:MngResource, MngRLUsersMngRadGridColumnsRoles %>" ItemStyle-Width="7%" >
                  <ItemTemplate>
                      <asp:Label ID="RolesDataLabel" SkinID="NormalText" runat="server" Text="..." ToolTip='<%# Eval("RolesNam") %>'></asp:Label>
                  </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn UniqueName="Email" HeaderText="<%$ Resources:MngResource, MngRLUsersMngRadGridColumnsEmail %>" ItemStyle-Width="30%" ItemStyle-HorizontalAlign="Left" DataField="Email">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="LastEdit" HeaderText="Last Edit" ItemStyle-Width="26%" >
                  <ItemTemplate>
                      <table border="0" cellpadding="0" cellspacing="0" width="100%">
                         <tr valign="top">
                           <td width="25">
                              <asp:Label ID="ByLabel" runat="server" SkinID="FieldNameLabel" Text="By:"></asp:Label>
                           </td>
                           <td width="*">
                              <asp:Label ID="LastEditedByNameDataLabel" SkinID="NormalText" runat="server" Text='<%# Eval("LastEditedByName") %>'></asp:Label>
                           </td>
                         </tr>
                         <tr>
                            <td width="25">
                              <asp:Label ID="DateLabel" runat="server" SkinID="FieldNameLabel" Text="Date:"></asp:Label>
                           </td>
                           <td width="*">
                              <asp:Label ID="DateDataLabel" runat="server" Text='<%# Eval("LastEditedDate") %>'></asp:Label>
                           </td>
                         </tr>
                      </table>
                  </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridButtonColumn ConfirmText="<%$ Resources:TelerikResource, RadGridDeleteColumnConfirmText %>" ConfirmDialogType="RadWindow" ItemStyle-Width="7%"
                    ConfirmTitle="<%$ Resources:TelerikResource, RadGridDeleteColumnConfirmTitle %>" ButtonType="ImageButton" CommandName="Delete" Text="<%$ Resources:TelerikResource, RadGridDeleteColumnText %>"
                    UniqueName="DeleteColumn">
                    <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                </telerik:GridButtonColumn>
            </Columns>
            <EditFormSettings UserControlName="SubUserControl.ascx" EditFormType="WebUserControl">
                <EditColumn UniqueName="EditCommandColumn1">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
    </telerik:RadGrid>

If it is possible, let me know how can I do that

Regards,
Bader
Mira
Telerik team
 answered on 15 Nov 2011
2 answers
400 views
Hi,
Using RadFileExplorer, I want the user to be able to create new subfolders. However, I want to limit this ability to certain existing folders.
Example: The user may create subfolders in folder "Pictures", but not in folder "Agreement".
I can use the server-side OnItemCommand event and cancel the operation if RadFileExplorerEventArgs.Command=="CreateDirectory" and RadFileExplorerEventArgs.Path is not a folder that allows subfolders, but at this point the user has already entered the name of the new folder and pressed OK.
The best solution,  I think, would be to disable the Create folder button (and context-menu choice) client-side, depending on which folder is the current folder. Something like this (for the toolbar button):

 

<telerik:RadFileExplorer OnClientFolderChange="OnClientFolderChange" EnableCreateNewFolder="True"....

Javascript:

function OnClientFolderChange(sender, args) {
    if(args.get_path() != 
"Pictures") {
        var tbitem = 
sender.get_toolbar().findItemByValue("NewFolder");
        
if(tbitem != 
null{
            tbitem.disable();
        }
    }
}

Unfortunately, this does not work. The toolbar button gets disabled, but then enabled again, immediately after.

In addition, this would be solved very easily if the EnableCreateNewFolder property of RadFileExplorer could be set client-side, using javascript. Is that possible, or do you guys have a different solution?

Thanks,

Arnstein

Dobromir
Telerik team
 answered on 15 Nov 2011
5 answers
170 views
  Dear telerik,
   
     I use a radfilter for filter the RadGrid. Now I save the value of radfilter SaveSettings function.I need load the setting when pageload.
     any idea? thanks!
James Campbell
Top achievements
Rank 1
 answered on 15 Nov 2011
2 answers
257 views
Seems like this should be simple, but I'm not seeing it.
I have a RadListView displaying data from a table and I have LinkButtons on each item to delete them. Everything fires like I would expect but I'm having trouble in my ItemCommand event.

In my ItemCommand event I just need to be able to access my "pri_key" column of the bound table.
I'm used to doing something like e.Item.DataItem("pri_key") in other bound controls but I don't see anything like that.
How should I be accessing this? Thanks!

Thanks!
Sebastian
Telerik team
 answered on 15 Nov 2011
6 answers
1.0K+ views
Hi,

AllowColumnResize

 

 

="True" in the rad gird. This allows resizing the columns to any width. I want to set a minimum value to which the column width can be reduced. if the user tries to reduce the width of the column lower than what is specified , then the width should be set to the minimum value mentioned.

Kindly let us know if this can be achieved and how.

Thanks,
Sudha.

Jayesh Goyani
Top achievements
Rank 2
 answered on 15 Nov 2011
3 answers
78 views
I have hierarchical Grid .If i Dont have Childs Then it should Not show expand Button.How to do That.
Jayesh Goyani
Top achievements
Rank 2
 answered on 15 Nov 2011
3 answers
202 views
Hi telerik team,

Is any possible to Remove/Hide the "Remove Element" in the Node inspector.

For E.g

div>ul>li>Remove ELement

Instead of we need only

div>ul>li

Rumen
Telerik team
 answered on 15 Nov 2011
1 answer
101 views
I want to access label field in itemtemplate and change the text at run time when in edit mode.
Andrey
Telerik team
 answered on 15 Nov 2011
1 answer
180 views
I am using your 'rating & comment' example as the starting blocks for a ratings system I am building but I have hit a snag when using inside a repeater.

Line 13:        function OnClientRated(controlRating, args) {
Line 14:             var tooltip = $find("<%= RadToolTip1.ClientID %>");
Line 15:             tooltip.show();
Line 16:         }

My browser is telling me it cant find 'RadToolTip1' as it is within a repeater. How do I fix this? What do I need to change on the JS so it can see the radtooltip?

Also, how do I get the values of the RadRating control (RadRating1) from within a repeater? Can I use OnItemCommand and pass in arguments and commnds???

Many thanks
Simon
Slav
Telerik team
 answered on 15 Nov 2011
10 answers
207 views
Hello,

Is there a clientside event where I can iterate through rows or a single row cells and collect all controls from row? Problem is that their ClientIDs may vary depending on where the grid is located and I may not now their names at the moment. I tried to do the following:
function getRowControls(row, controlName) {
    var result = Array();
    var grid = $find(gridID);
    var master = grid.get_masterTableView();
    var columns = master.get_columns();
    for (var i = 0; i < columns.length; i++) {
        var control = getControlFromCell(row.get_cell(columns[i].get_uniqueName()), controlName);
        if (control)
            result.push(control);
    }
    return result;
}
function getControlFromCell(cell, ctlName) {
    if (cell == nullreturn null;
    var cellControls = cell.getElementsByTagName("*");
    for (var a = 0, b = cellControls.length; a < b; a++) {
        var f = cellControls[a].id;
        if (f && f.endsWith(ctlName)) {
            return $find(f);
        }
    }
    return null;
}

"controlName" here is only control name suffix which the same through all my controls. In my case it's "_templateEditControl". I tried OnRowCreated, OnMasterTableViewCreated, OnGridCreated but there are still no controls by the time they fire.
Is there an event which would fire when grid enters edit or insert mode? Or any, where I can iterate through row controls and do something with them.
Thank you.

Mira
Telerik team
 answered on 15 Nov 2011
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?