Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
66 views
this is my code , i want to this from design side not code behind

<telerik:RadGrid ID="RadGridEmployeeCost" runat="server" AllowSorting="True" AllowPaging="true"
    AllowFilteringByColumn="true" CellSpacing="0" GridLines="None" HeaderStyle-Font-Bold="true"
    Skin="Web20" OnNeedDataSource="RadGridEmployeeCost_NeedDataSource" ShowGroupPanel="true"
    OnColumnCreated="RadGridEmployeeCost_ColumnCreated">
    <ClientSettings AllowDragToGroup="True" />
</telerik:RadGrid>
protected void RadGridEmployeeCost_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
       {
               ObjCon.Open();
               SqlCommand ObjCmd = new SqlCommand("SELECT name,address,TelPhone,EmailId,Qualification FROM WorkSummary", ObjCon);
               ObjCmd.ExecuteNonQuery();
               SqlDataAdapter ObjDa = new SqlDataAdapter(ObjCmd);
               DataSet ds = new DataSet();
               ObjDa.Fill(ds);
               RadGridEmployeeCost.DataSource = ds;
           }
       }
  
protected void RadGridEmployeeCost_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
       {
           if ((e.Column is GridBoundColumn && e.Column.UniqueName == "TelPhone" || e.Column.UniqueName == "EmailId" || e.Column.UniqueName == "Qualification"))
           {
               GridBoundColumn column = e.Column as GridBoundColumn;
               column.AllowFiltering = false;
           }
       }
share the code to do this
thanks
Shinu
Top achievements
Rank 2
 answered on 31 Jul 2014
4 answers
182 views
I am creating a RadGrid programmatically in VB.Net and have set the AllowFilteringByColumn  = True and setup a CommandItemTemplate that contains a RadButton.

You can see the rendered grid in the attached Grid.png and the error I am getting in the Telerik.Web.UI.WebResource.axd. It looks like a problem with creating multiple filter items. Error description - "description "Sys.WebForms.PageRequestManagerServerErrorException: Multiple controls with the same ID 'FilterTextBox_CustomerNum' were found. FindControl requires that controls have unique IDs."" 

CustomerNum is the first column in the grid

Building the grid
Private Sub SetFilters(ByVal grid As RadGrid)
 
    grid.MasterTableView.AllowFilteringByColumn = gridConfiguration.EnableHeaderFiltering
    If gridConfiguration.EnableHeaderFiltering Then
        grid.MasterTableView.CommandItemTemplate = New RadGridCommandItemFilterTemplate
    End If
 
End Sub

CommandItemTemplate 
Friend Class RadGridCommandItemFilterTemplate
    Implements ITemplate
 
    Public showHideFilter As RadButton
 
    Public Sub New()
        MyBase.New()
    End Sub
 
    Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn
 
        showHideFilter = New RadButton With {.ID = "showHideFilter", .Text = "Show / Hide Filters",
                                             .CommandName = "ShowHideFilters", .OnClientCheckedChanged = "showHideFilters()"}
        container.Controls.Add(showHideFilter)
 
    End Sub
 
End Class

Aspx

    <telerik:RadScriptManager ID="ScriptManager" runat="server">
    </telerik:RadScriptManager>
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ConfigureGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ConfigureGrid" LoadingPanelID="AjaxLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadGrid runat="server" ID ="ConfigureGrid" GridLines="None" AutoGenerateColumns="false" Skin="WebBlue"/>
 
    <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel" runat="server"/>
 
    <asp:SqlDataSource ID="PrimaryDataSource" runat="server"/>
</form>
 
<script type="text/javascript">
 
    function showFilterItem() {
        var grid = $find("<%=ConfigureGrid.ClientID%>");
        if (grid) {
            grid.get_masterTableView().showFilterItem();
        }
    }
 
    function hideFilterItem() {
        var grid = $find("<%=ConfigureGrid.ClientID%>");
        if (grid) {
            grid.get_masterTableView().hideFilterItem();
        }
    }
 
    function showHideFilters() {
        var radButton = document.getElementById("showHideFilter");
        if (radButton) {
            if (radButton.checked) {
                showFilterItem();
            }
            else {
                hideFilterItem();
            }
        }
    }
</script>



Princy
Top achievements
Rank 2
 answered on 31 Jul 2014
1 answer
89 views
I'm counting number of appearing of a datafield by:
<telerik:PivotGridAggregateField DataField="StatusText" Aggregate="Count" Caption="Counts" UniqueName="Counts" IsHidden="false">
</telerik:PivotGridAggregateField>

The problem appears when I run the pivotgrid, there's a field of (blank) keeps on coming up with a value of "1" unexpectedly. I can see one common point for all (blank) data, they seem to happen to any columns that has no data in it. For Instance, in January 1st. I have no data for that day and the grid gives a value "1" with statustext = (blank) as a substitution. 

What property can I set to stop this? Below is my RadPivotGrid Settings. Thanks.
<telerik:RadPivotGrid ID="RadPivotGrid_DataView" runat="server" ConfigurationPanelSettings-DefaultDeferedLayoutUpdate="false" Height="100%" AggregatesPosition="Rows" AllowSorting="True" OnItemCommand="RadPivotGrid_DataView_ItemCommand" OnCellCreated="RadPivotGrid_DataView_CellCreated" DataSourceID="Sql_Contract_Details" EnableToolTips="True" EnableZoneContextMenu="True" EnableConfigurationPanel="True" OnFieldCreated="RadPivotGrid_DataView_FieldCreated" Skin="Metro" OnCellDataBound="RadPivotGrid_DataView_CellDataBound" Culture="en-GB" OnItemNeedCalculation="RadPivotGrid_DataView_ItemNeedCalculation" AllowPaging="True" PageSize="30">
                       <PagerStyle ChangePageSizeButtonToolTip="Change Page Size" PageSizeControlType="RadComboBox" AlwaysVisible="True" />
                       <Fields>...</Fields>
                       <ClientSettings EnableFieldsDragDrop="True">
                           <Scrolling AllowVerticalScroll="True"></Scrolling>
                       </ClientSettings>
                       <ConfigurationPanelSettings EnableOlapTreeViewLoadOnDemand="True" DefaultDeferedLayoutUpdate="True" LayoutType="OneByFour"></ConfigurationPanelSettings>
                   </telerik:RadPivotGrid>
Pavlina
Telerik team
 answered on 31 Jul 2014
3 answers
148 views
Hi there,

When I click to show/hide a column from the context menu with a multicolumn header the whole grid gets out whack due to the filter row ending up on the same row as the column headers (see pictures of before (Normal.png) and after (one_column_removed.png)). Any ideas why this is happening?


Here is my grid code:

<ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" EnableRowHoverStyle="True" AllowColumnHide="False">
	<Selecting AllowRowSelect="False" />
	<Resizing AllowColumnResize="True" AllowResizeToFit="True" ResizeGridOnColumnResize="False" />
	<Scrolling AllowScroll="True" UseStaticHeaders="True" />
	<ClientMessages DragToGroupOrReorder="Click the Header to Sort; Drag to Reorder; Right Click for Context Menu" />
</ClientSettings>

...

<
ColumnGroups>
<telerik:GridColumnGroup HeaderText="MHO Portal Access" Name="User" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
<telerik:GridColumnGroup HeaderText="Census Tract Exclusions" Name="CT" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
<telerik:GridColumnGroup HeaderText="Rental Listings" Name="Rental" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
<telerik:GridColumnGroup HeaderText="Real Estate Professionals" Name="REP" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
</ColumnGroups>
 
<Columns>
<telerik:GridBoundColumn DataField="MHA" HeaderText="MHA" SortExpression="MHA" UniqueName="MHA" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False" FilterControlWidth="75px"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="MHA_MHO_ID" HeaderText="MHA_MHO_ID" SortExpression="MHA_MHO_ID" UniqueName="MHA_MHO_ID" Visible="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Service_Name" FilterControlAltText="Filter Service_Name column" HeaderTooltip="Service" HeaderText="Service" SortExpression="Service_Name" UniqueName="Service_Name" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False" FilterControlWidth="75px"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Is_Primary" FilterControlAltText="Filter Is_Primary column" HeaderTooltip="Role" HeaderText="Role" SortExpression="Is_Primary" UniqueName="Is_Primary" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False" FilterControlWidth="75px"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="MHO_Name" FilterControlAltText="Filter MHO_Name column" HeaderTooltip="MHO Name" HeaderText="MHO Name" SortExpression="MHO_Name" UniqueName="MHO_Name" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False" FilterControlWidth="75px"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="POC" HeaderText="POC" SortExpression="POC" UniqueName="POC" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False" Display="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Title" HeaderText="Title" SortExpression="Title" UniqueName="Title" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False" Display="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Phone_Number" HeaderText="Phone" SortExpression="Phone_Number" UniqueName="Phone_Number" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False" Display="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Email" HeaderText="Email" SortExpression="Email" UniqueName="Email" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False" Display="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="First_Login" HeaderText="First Login" ColumnGroupName="User" SortExpression="First_Login" UniqueName="First_Login" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Last_Login" HeaderText="Last Login" ColumnGroupName="User" SortExpression="Last_Login" UniqueName="Last_Login" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CT_Submission" HeaderText="Submit" ColumnGroupName="CT" SortExpression="CT_Submission" UniqueName="CT_Submission" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CT_Total" HeaderText="Total" ColumnGroupName="CT" SortExpression="CT_Total" UniqueName="CT_Total" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CT_Included" HeaderText="In." ColumnGroupName="CT" SortExpression="CT_Included" UniqueName="CT_Included" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CT_Excluded" HeaderText="Ex." ColumnGroupName="CT" SortExpression="CT_Excluded" UniqueName="CT_Excluded" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CT_Neutral" HeaderText="NA" ColumnGroupName="CT" SortExpression="CT_Neutral" UniqueName="CT_Neutral" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CT_Percent_Excluded" HeaderText="% Ex" ColumnGroupName="CT" SortExpression="CT_Percent_Excluded" UniqueName="CT_Percent_Excluded" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CT_Percent_Updated" HeaderText="% Updated" ColumnGroupName="CT" SortExpression="CT_Percent_Updated" UniqueName="CT_Percent_Updated" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Rental_Submission" HeaderText="Submit" ColumnGroupName="Rental" SortExpression="Rental_Submission" UniqueName="Rental_Submission" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Rental_Total" HeaderText="Total" ColumnGroupName="Rental" SortExpression="Rental_Total" UniqueName="Rental_Total" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Rental_Current" HeaderText="Current" ColumnGroupName="Rental" SortExpression="Rental_Current" UniqueName="Rental_Current" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="REP_Submission" HeaderText="Submit" ColumnGroupName="REP" SortExpression="REP_Submission" UniqueName="REP_Submission" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="REP_Total" HeaderText="Total" ColumnGroupName="REP" SortExpression="REP_Total" UniqueName="REP_Total" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="REP_Current" HeaderText="Current" ColumnGroupName="REP" SortExpression="REP_Current" UniqueName="REP_Current" Visible="True" FilterControlWidth="75px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="False"></telerik:GridBoundColumn>
</Columns>

Thank you,

Tom
Pavlina
Telerik team
 answered on 31 Jul 2014
1 answer
1.3K+ views
Hi 

Please let me know How to set the row height of RadGrid  

Shinu
Top achievements
Rank 2
 answered on 31 Jul 2014
4 answers
1.2K+ views
I have a RadDateTimePicker on a page of my C# DotNet 4.0 web app.  
The idea is that every time the selected date changes, the event handler updates a text box. 
This is intended to be an Ajax event, not a full page postback.
To this end, the controls are set up in the RadAjaxManager as follows:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >      
        <AjaxSettings>            
            <telerik:AjaxSetting AjaxControlID="rdtDateTime">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="txtCount" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>        
    </telerik:RadAjaxManager>

This works perfectly, unless in the page load event I set the SelectedDate property of the RadDateTimePicker.
If I do that the SelectedDateChanged event stops firing. 

Suggestions?  
Princy
Top achievements
Rank 2
 answered on 31 Jul 2014
1 answer
78 views
Hi

My submenu does not replicate the same style as my menu.

The submenu items seem to be smaller than the menu items.

Any help would be appreciated with this. 

Grant
Shinu
Top achievements
Rank 2
 answered on 31 Jul 2014
6 answers
232 views
Hello,

I had a scenario where I have to make a gridboundcolumn editable based on griddropdowncolumn selection. I am able to fire the selectindexchanged event for the griddropdowncolumn but could not figure how to change the readonly property of a column in the event.

Any help would be greatly appreciated.

Thanks,
Kevin
Shinu
Top achievements
Rank 2
 answered on 31 Jul 2014
1 answer
94 views
Hi Team,

Couple of days back I saw grid demo which is having Edit, delete and insert buttons in one cell of row. 
If the user mouse over on that cell its expands and show edit,delete and insert buttons (grid data won't expand).
Can you please provide that demo link or code.

Thanks in Advance.
Princy
Top achievements
Rank 2
 answered on 31 Jul 2014
1 answer
90 views
I have a modal that has a source ListBox and a selected ListBox with AllowTransfer="true". I also have AutoPostBackOnTransfer="true" because otherwise the selected items didn't persist. the problem I'm having is that when I transfer an item and there is a postback, the ListBox of selected items moves from the right side of the source to directly below it. I can't figure out why this is happening. See the attached screen shots.

Here is the modal and the button that opens it:

                                            <asp:LinkButton ID="btnDeptDCVL" runat="server" Style="cursor: pointer; text-decoration: underline; padding-left: 10px" Text="Select" />
                                            <ajaxtoolkit:ModalPopupExtender ID="mPopupDept" runat="server" PopupControlID="pnlDept"
                                                TargetControlID="btnDeptDCVL" BackgroundCssClass="modalProgressGreyBackground"
                                                DropShadow="false">
                                            </ajaxtoolkit:ModalPopupExtender>
                                            <asp:Panel ID="pnlDept" runat="server" Height="450px" Width="514px" Style="display: none; background-color: AntiqueWhite;">
                                                <div style="padding: 20px">
                                                    Select Departments from the left. Double-click, drag and drop, or click the arrows to select.<br />
                                                    <telerik:RadAjaxPanel runat="server" ID="rap1">
                                                        <telerik:RadListBox ID="rlbDeptDCVL" runat="server" Width="250" Height="350" TransferMode="Copy"
                                                            AllowTransfer="true" AllowTransferOnDoubleClick="true" EnableDragAndDrop="true" AutoPostBackOnTransfer="true"
                                                            TransferToID="rlbSelectedDeptDCVL">
                                                            <ButtonSettings Position="Right" />
                                                        </telerik:RadListBox>
                                                        <telerik:RadListBox ID="rlbSelectedDeptDCVL" runat="server" Width="220" Height="350">
                                                        </telerik:RadListBox>
                                                    </telerik:RadAjaxPanel>
                                                    <p style="text-align: center;">
                                                        <asp:LinkButton ID="lnkOKDeptDCVL" runat="server" Text="OK" class="label" />
                                                        &nbsp;&nbsp;
                                                        <asp:LinkButton ID="lnkCancelDeptDCVL" runat="server" Text="Cancel" class="label" />
                                                    </p>
                                                </div>
                                            </asp:Panel>
Kim
Top achievements
Rank 1
 answered on 30 Jul 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?