Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
1.1K+ views
I'm new to the Telerik library and one of my first tasks is to get a total of the values in a numeric column of a Telerik RadGrid. The column is a GridClientSelectColumn. I understand that by setting the Aggregate="Sum", the footer will read the summation of that column. The problem is that I only want a summation of the selected rows. Can someone provide a demonstration. Thank you in advance! 
Eyup
Telerik team
 answered on 16 Dec 2014
1 answer
1.0K+ views
I have tried the css as always to give some borders to my grid columns and removed the last columns right borders because I didn't need them. I have tried to use the css class='rgHeader  LeftBorder' in HeaderStyle tag of those coulmns but it doesn't remove the header border. Please help me as soon as possible. My codes are:
div.RadGridCustomClass .rgHeader,
div.RadGridCustomClass th.rgResizeCol,
div.RadGridCustomClass .rgFooter td,
div.RadGridCustomClass .rgFilterRow td {
border-left: 1px solid #f0f0f0 !important;
border-right: 1px solid #f0f0f0 !important;
}

div.RadGridCustomClass .rgMasterTable{
font-family: Calibri !important;
font-size: 11pt;
}
div.RadGridCustomClass .rgMasterTable .rgHeader{
font-family: Calibri !important;
font-size: 11pt;
font-weight: bold;
}
div.RadGridCustomClass .rgAltRow td {
border-bottom: 0px !important;
}
div.RadGridCustomClass .rgMasterTable,
div.RadGridCustomClass {
border: 0px !important;
}
div.RadGridCustomClass .rgMasterTable td {
border-right: 1px solid #f0f0f0 !important;
}


div.RadGridCustomClass .rgMasterTable:last-child,
div.RadGridCustomClass td:last-child {
border: 0px !important;
}
div.RadGridCustomClass th.LeftBorder,
div.RadGridCustomClass .rgRow td.LeftBorder,
div.RadGridCustomClass .rgAltRow td.LeftBorder,
div.RadGridCustomClass .rgEditRow td.LeftBorder
{

border-right-width:0px !important;
}
<telerik:RadGrid ID="ToolkitSections" runat="server" AutoGenerateColumns="False" OnNeedDataSource="ToolkitSectionsNeedDataSource" OnItemDataBound="ToolkitSections_ItemDataBound" OnUpdateCommand="ToolkitSections_UpdateCommand" CellSpacing="-1" OnItemCreated="ToolkitSections_ItemCreated" AllowSorting="True" CssClass="RadGridCustomClass" Font-Names="Calibri" EnableViewState="False" OnPreRender="ToolkitSections_PreRender" Width="90%">
                                                <MasterTableView DataKeyNames="ToolkitSectionID,Progress,SectionDenied,Status,Restricted" EditMode="InPlace" ClientDataKeyNames="ToolkitSectionID" >
                                                    <RowIndicatorColumn Visible="False">
                                                    </RowIndicatorColumn>                                                    <ExpandCollapseColumn Created="True">
                                                    </ExpandCollapseColumn>                                                    <Columns>
                                                        <telerik:GridHyperLinkColumn AllowFiltering="False" DataNavigateUrlFields="SectionUrl" DataTextField="SectionName" FilterControlAltText="Filter SectionUrl column" Groupable="False" HeaderText="Section" Reorderable="False" Resizable="False" SortExpression="Section Name" UniqueName="SectionUrl">
                                                        <HeaderStyle ForeColor="white" CssClass="headerfont"></HeaderStyle>
                                                        </telerik:GridHyperLinkColumn>
                                                        <telerik:GridDateTimeColumn AllowFiltering="False" DataField="LastModified" DataFormatString="{0:MM/dd/yyyy}" FilterControlAltText="Filter Last Modified column" Groupable="False" HeaderText="Modified" Reorderable="False" Resizable="False" UniqueName="LastModified" ReadOnly="True">
                                                            <ColumnValidationSettings>
                                                                <ModelErrorMessage Text="" />
                                                            </ColumnValidationSettings>
                                                             <HeaderStyle ForeColor="white" CssClass="RightBorder"></HeaderStyle>
                                                        </telerik:GridDateTimeColumn>
                                                       
                                                             
                                                        <telerik:GridCheckBoxColumn AllowFiltering="False" DataField="Complete" DataType="System.Boolean" FilterControlAltText="Filter Complete column" Groupable="False" HeaderText="Complete" Reorderable="False" Resizable="False" UniqueName="Complete" ReadOnly="True">
                                                         <HeaderStyle ForeColor="white" ></HeaderStyle>
                                                        </telerik:GridCheckBoxColumn>                                                        <telerik:GridTemplateColumn UniqueName="Restricted" HeaderText="Restrict" FilterControlAltText="Filter Restricted column" Reorderable="False" Resizable="False" ShowSortIcon="False">
                                                            <ItemTemplate>
                                                                <div>
                                                                    <div style="float: left">
                                                                        <asp:CheckBox ID="cbRistrict" runat="server" AutoPostBack="true" OnCheckedChanged="cbRistrict_OnCheckedChanged" onclientclick="this.checked=true;"></asp:CheckBox>
                                                                    </div>
                                                                    <div style="float: left">
                                                                        <asp:LinkButton ID="RestrictLinkButton" runat="server" BorderWidth="0"><img  style="text-decoration:none;border:0px;" src="~/Images/Lock-Restricted.png" runat="server"/></asp:LinkButton>
                                                                    </div>
                                                                </div>
                                                            </ItemTemplate>
                                                             <HeaderStyle ForeColor="white" ></HeaderStyle>                                                        </telerik:GridTemplateColumn>                                                        <telerik:GridDateTimeColumn AllowFiltering="False" DataField="SectionDueDate" DataFormatString="{0:MM/dd/yyyy}"  FilterControlAltText="Filter Section Due Date column" Groupable="False" HeaderText="Section Due Date" Reorderable="False" Resizable="False" UniqueName="SectionDueDate">
                                                           <HeaderStyle Width="120px" HorizontalAlign="Right" CssClass="rgHeader LeftBorder"></HeaderStyle>
                                                             <ItemStyle Width="80" HorizontalAlign="Center" CssClass="LeftBorder"></ItemStyle>
                                                            <ColumnValidationSettings>
                                                                <ModelErrorMessage Text="" />                                                            </ColumnValidationSettings>
                                                             <HeaderStyle ForeColor="white"></HeaderStyle>
                                                        </telerik:GridDateTimeColumn>
                                                        <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="~/Images/date-icon.png" UniqueName="EditCommandColumn" ItemStyle-HorizontalAlign="Left" Reorderable="False" Resizable="False" ShowFilterIcon="False" ShowSortIcon="False">
                                                             <HeaderStyle ForeColor="white"  Width="10px" CssClass="rgHeader LeftBorder"></HeaderStyle>
                                                            <ItemStyle HorizontalAlign="Left" CssClass="LeftBorder" />                                                        </telerik:GridEditCommandColumn>                                                        <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="ToolkitSectionID" Groupable="False" HeaderText="ToolkitSection ID" Reorderable="False" Resizable="False" ShowSortIcon="False" UniqueName="ToolkitSectionID" ReadOnly="true" Display="False">
                                                            <ColumnValidationSettings>
                                                                <ModelErrorMessage Text="" />
                                                            </ColumnValidationSettings>
                                                             <HeaderStyle ForeColor="white" ></HeaderStyle>
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="Progress" FilterControlAltText="Filter Progress column" Groupable="False" HeaderText="Progress" Reorderable="False" Resizable="False" UniqueName="Progress" ReadOnly="True" DataType="System.Int16" Display="False" ShowSortIcon="False">
                                                            <ColumnValidationSettings>
                                                                <ModelErrorMessage Text="" />
                                                            </ColumnValidationSettings>
                                                             <HeaderStyle ForeColor="white" ></HeaderStyle>
                                                        </telerik:GridBoundColumn>                                                        <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="SectionDenied" Display="False" FilterControlAltText="Filter Section Denied column" Groupable="False" HeaderText="Section Denied" ReadOnly="True" Reorderable="False" Resizable="False" ShowSortIcon="False" UniqueName="SectionDenied">
                                                            <ColumnValidationSettings>
                                                                <ModelErrorMessage Text="" />
                                                            </ColumnValidationSettings>
                                                             <HeaderStyle ForeColor="white" ></HeaderStyle>
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="AnybodyDenied" Display="False" FilterControlAltText="Filter Section Denied column" Groupable="False" HeaderText="Section Denied" ReadOnly="True" Reorderable="False" Resizable="False" ShowSortIcon="False" UniqueName="AnybodyDenied">
                                                            <ColumnValidationSettings>
                                                                <ModelErrorMessage Text="" />
                                                            </ColumnValidationSettings>
                                                             <HeaderStyle ForeColor="white" CssClass="headerfont"></HeaderStyle>
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="Status" Display="False" FilterControlAltText="Filter Status Column" Groupable="False" HeaderText="Status" ReadOnly="True" Reorderable="False" Resizable="False" ShowSortIcon="False" UniqueName="Status">
                                                            <ColumnValidationSettings>
                                                                <ModelErrorMessage Text="" />
                                                            </ColumnValidationSettings>
                                                             <HeaderStyle ForeColor="white" ></HeaderStyle>
                                                        </telerik:GridBoundColumn>                                                    </Columns>                                                    <EditFormSettings>
                                                        <EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" CancelImageUrl="~/RadControls/Grid/Skins/Default/Cancel.gif" UpdateImageUrl="~/RadControls/Grid/Skins/Default/Update.gif">
                                                        </EditColumn>
                                                    </EditFormSettings>
                                                </MasterTableView>
                                            </telerik:RadGrid>
Konstantin Dikov
Telerik team
 answered on 16 Dec 2014
9 answers
281 views
Hello

I have to display a list of parameters with a hierarchic relation between them. I use a RadTreeList and it works fine.
My tree list has a "Value" column.

I would like to change some values in this column but I don't want to make the changes row by row (by entering in edit mode, making modification and updating). I'd prefer to keep all the rows in edit mode, make the modifications in some of them and validate by clicking on an external button.

I didn't find something like that in the demos.

 I tried to use an ItemTemplate for the edit column.
<telerik:RadTreeList runat="server" ID="RadTreeListParameters"
                                             Skin="Telerik"
                                             AutoGenerateColumns="false"
                                             DataKeyNames="ServiceParameterID" ParentDataKeyNames="ParentParameterID"
                                             AllowSorting="true"
                                             DataSourceID="ObjectDataSource1"
                                             OnDataBound="RadTreeListParameters_DataBound"
                                             ItemStyle-CssClass="RowStyle"
                                             AlternatingItemStyle-CssClass="AlternatingRowStyle"
                                             HeaderStyle-CssClass="HeaderStyle"
                                             SelectedItemStyle-CssClass="SelectedRowStyle"
                                             >
                            <ClientSettings>
                                <Scrolling AllowScroll="false" UseStaticHeaders="false" />
                                <Resizing AllowColumnResize="true" ResizeMode="NoScroll" />
                            </ClientSettings>
                            <Columns>
                                <telerik:TreeListBoundColumn DataField="ServiceParameterID" UniqueName="ServiceParameterID" HeaderText="ServiceParameterID" Display="true"></telerik:TreeListBoundColumn>
                                <telerik:TreeListBoundColumn DataField="Role" UniqueName="Role" HeaderText="Role" ReadOnly="true"></telerik:TreeListBoundColumn>
                                <telerik:TreeListBoundColumn DataField="Type" UniqueName="Type" HeaderText="Type" ReadOnly="true"></telerik:TreeListBoundColumn>
                                <telerik:TreeListBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name" ReadOnly="true"></telerik:TreeListBoundColumn>
                                <telerik:TreeListTemplateColumn DataField="Value" UniqueName="TemplateColumn" HeaderText="Value">
                                    <ItemTemplate>
                                        <asp:TextBox runat="server" ID="tbxValue" Value='<%# Eval("Value") %>' />
                                    </ItemTemplate>
                                </telerik:TreeListTemplateColumn>
                            </Columns>
                        </telerik:RadTreeList>

The display is correct but when there is a postback, the data are reloaded. So I would like to keep the modifications in a dictionary in order to overwrite the bound values.

protected void RadTreeListParameters_DataBound(object sender, EventArgs e)
{
    foreach (TreeListDataItem item in this.RadTreeListParameters.Items)
    {
        string id = item.GetDataKeyValue("ServiceParameterID").ToString();
 
        if (this.parameters_values_dico != null && this.parameters_values_dico.Keys.Contains(id))
        {
            (item["TemplateColumn"].FindControl("tbxValue") as TextBox).Text = this.parameters_values_dico[id];
        }
    }
}

My problem is that I can't get the event when a textbox is modified (to save the new value in the dictionary. I added:
AutoPostBack="true" OnTextChanged="tbxValue_TextChanged"  in my template textbox description but the method is never called.

Has anyone an idea to solve my problem or to provide another way to implement my feature  (without ItemTemplate and edit mode) ?

Thank you

Jean-Charles
Nikolay Rusev
Telerik team
 answered on 16 Dec 2014
6 answers
608 views
Hi,
I am facing an issue in validation in custom attaributes. See the attached image.
The Textbox shuold enter valid emails only.  And the error  mesage  should be show in the bottom of the textbox.Regular expression is possible in this? 

Its very urgent..pls do the needful

Thanks and regards
Nencho
Telerik team
 answered on 16 Dec 2014
3 answers
182 views
How do I get the menu text of the menu item selected with client side code?

Thanks
Aneliya Petkova
Telerik team
 answered on 16 Dec 2014
1 answer
287 views
I have a radgrid that 1. I cannot highlight the row on clicking and 2. the selectedindexchanged event does not fire.  The grid sits inside an update panel and is loaded when a user select a value from a combo box, which is passed as a parameter to a stored procedure.  The grid load without problem, but as mentioned once loaded I cannot click on the row and highlight the row and the selectedindexchanged event does not fire.  Below is the grid settings.  I have also tried  to add the following code on the page load, but this has not helped.
 this.grdItems.ClientSettings.EnablePostBackOnRowClick = true;
this.grdItems.ClientSettings.Selecting.AllowRowSelect = true;

Any suggestions?

<telerik:RadGrid ID="grdItems" runat="server" CellSpacing="0"
                                      DataSourceID="SqlDataSource1" GridLines="None" Height="400px"
                                      AccessKeySkin="Office2010Black"
                                         onselectedindexchanged="grdItems_SelectedIndexChanged"
                                         Skin="Office2010Black">
                                         <clientsettings>
                                          <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                                       <ClientEvents OnRowSelected="RowSelected" />
                                          <selecting AllowRowSelect="True" />
                                        </clientsettings>
                                        <mastertableview allowpaging="True" autogeneratecolumns="False"
                                         datakeynames="ID" datasourceid="SqlDataSource1" pagesize="14">
                                         <Columns>
                                            <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" Display="False"
                                             FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True"
                                             SortExpression="ID" UniqueName="ID">
                                             </telerik:GridBoundColumn>
                                             <telerik:GridBoundColumn DataField="HoseID"
                                              FilterControlAltText="Filter HoseID column" HeaderText="Hose ID"
                                              ReadOnly="True" SortExpression="HoseID" UniqueName="HoseID">
                                              <HeaderStyle Font-Bold="True" Font-Size="Larger" />
                                             </telerik:GridBoundColumn>
                                         </Columns>
                                      </mastertableview>
                                     </telerik:RadGrid>
Konstantin Dikov
Telerik team
 answered on 16 Dec 2014
4 answers
108 views
Hi Telerik, 

I posted a thread a couple of days ago and I thought I had solved my problem but turns out I just moved it.

My problem now is that I have template columns that contain buttons and others that have text that needs to be on a different color depending on the status of the item.

So basically, I used to bind my grid using the 'simple way' (Create data table, add source to the grid and bind)
Once it was bound, I would go through each rows, set the text to the button and set the appropriate CSS on the text label. 

Since I needed to sort and to filter, I saw that I could use the 'OnNeedDataSource' event, which is the second way to bind a grid.

This worked and I could sort/filter my grid.

But now, after the event is called, I tried to change the CSS and the text again but it says that the grid doesnt have any items.

I believe its because it wasnt bound (even though I can see the rows once everything is done)



Eyup
Telerik team
 answered on 16 Dec 2014
1 answer
82 views
Hi,

If I use a grid smart tag to edit the EditTemplate and drag a control into the edit box provided, it produces this code in <MasterTableView>:

<EditItemTemplate>
    <asp:Button ID="Button1" runat="server" Text="Button" />
</EditItemTemplate>

but when my template opens it shows nothing, basically just a title bar with no content. When I use the code below (which I got from your website) then the template shows up just fine - so just what is EditItemTemplate all about?

<EditFormSettings EditFormType="Template">
    <PopUpSettings Modal="True" />
    <FormTemplate>
        <telerik:RadTextBox ID="Username" Runat="server">
        </telerik:RadTextBox>
    </FormTemplate>
</EditFormSettings>
Eyup
Telerik team
 answered on 16 Dec 2014
1 answer
72 views
Good morning.

This is my first post, so I will do my best to cover everything as thoroughly as possible. I am implementing a RadGrid in an ASP.NET project. Here are the particulars:

Windows 7
IE 11
ASP.NET 4.5
preferred language is VB
latest version of Telerik Tools

I have followed the instructions of several examples I've found online, including some here, but to no avail. No matter what I do, when I click any button in my RadGrid - Add, Edit, Cancel, etc. I get a PostBack. After clicking any button, all subsequent attempts to interact with the RadGrid fail due to the postback. I just want to use AJAX. Here is my RadGrid code:

<telerik:RadGrid ID="attachment_list" runat="server"
    OnNeedDataSource="attachment_list_NeedDataSource"
    AutoGenerateColumns="False"
    AllowPaging="True"
    PageSize="30"
    AllowAutomaticDeletes="True"
    AllowAutomaticInserts="True"
    AllowAutomaticUpdates="True"
    OnEditCommand="attachment_list_EditCommand"
    GroupPanelPosition="Top" >           
    <HeaderContextMenu EnableAutoScroll="True"
    </HeaderContextMenu
    <MasterTableView                    
        CommandItemDisplay="Top"
        NoMasterRecordsText="There are currently no attachments">
        <CommandItemSettings AddNewRecordText="Attach Another File" />                        
        <RowIndicatorColumn
            <HeaderStyle Width="20px"></HeaderStyle
        </RowIndicatorColumn
        <ExpandCollapseColumn
            <HeaderStyle Width="20px"></HeaderStyle
        </ExpandCollapseColumn>
        <NoRecordsTemplate>
            <div ID="no_data_label">There are currently no attachments</div>
        </NoRecordsTemplate
        <Columns
            <telerik:GridBoundColumn DataField="AttachmentPath" HeaderText="File Name" UniqueName="FileName" ItemStyle-Width="340px">  
            </telerik:GridBoundColumn
            <telerik:GridBoundColumn DataField="AttachmentDescriptors" HeaderText="Description" UniqueName="Desc" ItemStyle-Width="450px">  
            </telerik:GridBoundColumn>                       
            <telerik:GridBoundColumn DataField="LastUpdatedDate" HeaderText="Updated Date" UniqueName="UpdatedDate" ItemStyle-Width="200px">  
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="UpdatedByName" HeaderText="Updated By" UniqueName="UpdatedBy" ItemStyle-Width="200px">  
            </telerik:GridBoundColumn>                                                     
            <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this item?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete"
                ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                <ItemStyle HorizontalAlign="Center" CssClass="delete_button"></ItemStyle>
            </telerik:GridButtonColumn>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                <ItemStyle CssClass="edit_button"></ItemStyle>
            </telerik:GridEditCommandColumn>                   
        </Columns>
                 
        <EditFormSettings EditFormType="Template">
            <FormTemplate>
                <asp:Panel ID="attachment_edit" runat="server" GroupingText='<%# IIf((TypeOf (Container) Is GridEditFormInsertItem), "Add an Attachment", "Update an Attachment")%>'>
                    <div class="inner_1">
                        <div class="float_left">
                            <asp:Panel ID="att_file_wrapper" runat="server">
                                <div class="label">Select File:</div>               
                                <telerik:RadUpload ID="att_file" runat="server" ReadOnlyFileInputs="True" ControlObjectsVisibility="none" ></telerik:RadUpload>
                            </asp:Panel>
                            <div class="label">Description:</div><asp:TextBox ID="att_desc" runat="server" Text='<%# Bind("AttachmentDescriptors")%>'></asp:TextBox>                                  
                        </div>                                   
                    </div>
                </asp:Panel>
 
                <div class="btn_group_small">
                    <asp:Button runat="server" ID="add_task" Text='<%# IIf((TypeOf (Container) Is GridEditFormInsertItem), "Add Attachment", "Update Attachment")%>'
                        CommandName='<%# IIf((TypeOf (Container) Is GridEditFormInsertItem), "Insert", "Update")%>' CssClass="small_btn" />
                    <asp:Button runat="server" ID="cancel_task" Text="Cancel" CommandName="Cancel"
                        CausesValidation="False" CssClass="small_btn" />
                </div>
 
            </FormTemplate>
        </EditFormSettings>                
    </MasterTableView>                       
</telerik:RadGrid>

Here is my Ajax Manager code (my primary RadAjaxManager is in the Matser page):

<telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server" >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="attachment_list">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="attachment_list" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>                      
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>

I am fairly new to using Telerik (and .NET in general), and I'm on a tight deadline. Any assistance would be appreciated - thanks.
Maria Ilieva
Telerik team
 answered on 16 Dec 2014
1 answer
96 views
Respected Sir/M'am,

we are currently facing an issue in RadAsyncUpload where :
1)  After the file is uploaded, if any postback occurs (may it

be a cancel button postback or any other control postback) the

uploaded file is directly moved to the target folder



Is there any solution where on specified control click only ,

the uploaded file can be moved to target folder else it will

persist as it is uploaded.


Regards,
GIPL Team
Hristo Valyavicharski
Telerik team
 answered on 16 Dec 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?