Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
1.2K+ views

Hey guys,

 

I'm currently trying to achieve to have a specific year selected on initialize in the code behind. I try to select the current year by default and fill some years into the box. As soon as I switch the year and reload the page the radgrid takes the correct value but it gets displayed the old value (for example 2015) . Anyone has an Idea how to fix that? I already tried to clear all items before setting the datasource.

 

Thanks in advance,

Daniel

Attila Antal
Telerik team
 answered on 25 Oct 2019
3 answers
299 views

     I have built dozens of grids with command menus with no issues, but this one does not show?

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
    Width="1200px" CommandItemDisplay="Top"
    RenderMode="Auto" AllowPaging="True" AllowSorting="True" PageSize="50" ShowHeader="true">
    <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
    <ExportSettings FileName="Agenda">
    </ExportSettings>
    <ClientSettings EnableRowHoverStyle="True">
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
    <MasterTableView DataKeyNames="ID" CommandItemDisplay="Top" PageSize="25">
        <CommandItemSettings ShowAddNewRecordButton="False" ShowPrintButton="true" ShowExportToExcelButton="True" ShowExportToCsvButton="true" ShowRefreshButton="False" />
        <RowIndicatorColumn Visible="False">
        </RowIndicatorColumn>
        <ExpandCollapseColumn Created="True">
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridTemplateColumn HeaderText="Client" SortExpression="Client" UniqueName="flname">
                <ItemTemplate>
                    <asp:HyperLink ID="editClient" runat="server" NavigateUrl="#" Text='<%# Eval("flname") %>'></asp:HyperLink>
                </ItemTemplate>
                <ItemStyle Width="125px" Font-Size="8" />
            </telerik:GridTemplateColumn>

            <telerik:GridBoundColumn DataField="APTCPTCode" HeaderText="CPT Code" UniqueName="APTCPTCode" Display="True">
                <ItemStyle Width="50px" Font-Size="8" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="Start" DataType="System.DateTime" Display="True" FilterControlAltText="Filter Start column" HeaderText="Date" SortExpression="Start" UniqueName="Start" DataFormatString="{0:g}">
                <ItemStyle Width="125px" HorizontalAlign="Center" Font-Size="8" />
                <HeaderStyle HorizontalAlign="Center" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="Status" HeaderText="Status" UniqueName="Status" Display="True">
                <ItemStyle Width="50px" Font-Size="8" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="Duration" DataType="System.Int32" HeaderText="Min" ReadOnly="True" SortExpression="Duration" UniqueName="Duration" HeaderStyle-HorizontalAlign="Center" Visible="True">
                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                <ItemStyle Width="40px" HorizontalAlign="Center" Font-Size="8" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="ClientID" FilterControlAltText="Filter ClientID column" HeaderText="ClientID" SortExpression="ClientID" UniqueName="ClientID" Display="false">
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="Subject" FilterControlAltText="Filter Subject column" HeaderText="Subject" SortExpression="Subject" UniqueName="Subject" Visible="True">
                <ItemStyle Width="80px" Font-Size="8" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="Practitioner" HeaderText="Staff" SortExpression="Practitioner" UniqueName="Practitioner" Display="True">
                <ItemStyle Width="100px" Font-Size="8" />
            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn DataField="RoomName" FilterControlAltText="Filter RoomName column" HeaderText="Room" SortExpression="RoomName" UniqueName="RoomName" Visible="true">
                <ItemStyle Width="80px" Font-Size="8" />
            </telerik:GridBoundColumn>
            <telerik:GridCheckBoxColumn DataField="Owner" HeaderText="Owner" DataType="System.Boolean"></telerik:GridCheckBoxColumn>

            <telerik:GridCheckBoxColumn DataField="HasInsurance" HeaderText="Insurance" DataType="System.Boolean"></telerik:GridCheckBoxColumn>

            <telerik:GridBoundColumn DataField="UserID" DataType="System.Int32" Visible="False" FilterControlAltText="Filter UserID column" HeaderText="UserID" SortExpression="UserID" UniqueName="UserID">
            </telerik:GridBoundColumn>
        </Columns>
        <CommandItemTemplate>
        </CommandItemTemplate>
    </MasterTableView>

    <FilterMenu RenderMode="Auto"></FilterMenu>

    <HeaderContextMenu RenderMode="Auto"></HeaderContextMenu>
</telerik:RadGrid>

Vessy
Telerik team
 answered on 25 Oct 2019
1 answer
84 views

Hello,

I have an AdvancedInsertTemplate with and RequiredFieldValidator. When I want to cancel the insert (push button Cancel with commandname cancel), the RequiredFieldValidator is active and I can't cancel the insert( the modal doesn't close).

Could you give me a solution ?

 

Thank you

HYSCAD

Patrick
Top achievements
Rank 1
 answered on 24 Oct 2019
8 answers
352 views

Hello,
I am binding columns dynamically to my grid as per this article:
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html#Section21

I am also attempting to implement a drop-down filter box as per this article:
http://www.telerik.com/help/aspnet-ajax/grid-filtering-with-dropdownlist.html

But when I postback the the grid for any reason (refresh, paging, or applying a filter), I get the following exception:

Cannot create column with the specified type name: CustomFilteringColumn

How can I make this programatic column (instanciated at Page_Load) play nice with the column creation on post-backs?

here is my class that inherits from GridBound Column (as per the 2nd article):

    public class CustomFilteringColumn : GridBoundColumn
    {
 
        protected override void SetupFilterControls(System.Web.UI.WebControls.TableCell cell)
        {
            RadComboBox rcBox = new RadComboBox();
            rcBox.ID = "ddlFilter_" + Guid.NewGuid().ToString();
            rcBox.AutoPostBack = true;
            rcBox.DataTextField = this.DataField;
            rcBox.DataValueField = this.DataField;
            rcBox.SelectedIndexChanged += rcBox_SelectedIndexChanged;
 
            RadComboBoxItem blankItem = new RadComboBoxItem(string.Empty, string.Empty);
            rcBox.Items.Add(blankItem);
 
            // add other items to the dropdown here
 
            cell.Controls.Add(rcBox);
        }
 
        protected override void SetCurrentFilterValueToControl(System.Web.UI.WebControls.TableCell cell)
        {
            base.SetCurrentFilterValueToControl(cell);
        }
 
        protected override string GetCurrentFilterValueFromControl(System.Web.UI.WebControls.TableCell cell)
        {
            return base.GetCurrentFilterValueFromControl(cell);
        }
 
        private void rcBox_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter"new System.Web.UI.Pair());
        }
    }

Thanks,
Ben

John
Top achievements
Rank 1
 answered on 23 Oct 2019
1 answer
107 views

 have a RadGrid which has a main data source dsA. I have a foreign key column on this dsA called fColumn having integer values, on which I am getting the relevant text of this fColumn from a second table "tblB". The tblB has two columns (id and text) which the id is corresponding to fColumn.
I want to have the FilterCheckList values in the grid from this tblB, column named "text" which I did as:

<telerik:GridBoundColumn DataField="fColumn" FilterCheckListEnableLoadOnDemand="true"
                HeaderText="HeaderTxt" SortExpression="fColumn" UniqueName="fColumn">        
 </telerik:GridBoundColumn>

 

and in the code.cs file:

protected void RadGrid1_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
 {
            string DataField = (e.Column as IGridDataColumn).GetActiveDataField();
            e.ListBox.DataSource = dsTblB;
            e.ListBox.DataKeyField = "id";
            e.ListBox.DataTextField = "text";
            e.ListBox.DataValueField = "id";
            e.ListBox.DataBind();
 }

 

What I am getting as error in alert when I am clicking on this filter:
fColumn is neither a DataColumn nor a DataRelation for table DefaultView.

So how this above scenario can be easily achieved with Telerik controls.

PS: I don't want to use SQL Joins for filling the Grid in the query.
Thanks in Advance!

Eyup
Telerik team
 answered on 23 Oct 2019
5 answers
267 views
Dear Telerik Team, 

Using the RadDiagram I would like to connect a number of shapes and to include meaning regarding the connection. Common sense tells me that the 2 lines below ought to accomplish this task and assign the "Connection Test" string to the connection. However, somehow that's not working out too well for me. If you could give me a pointer in the right direction to get this accomplished that would be much appreciated. 

Dim connection = New DiagramConnection()
connection.ContentSettings.Text = "Connection Test"

Additionally, I was wondering if there is any way to execute something server side when the user clicks / double clicks on a DiagramShape?

Thank you for your assistance, 

Andre. 
Vessy
Telerik team
 answered on 23 Oct 2019
9 answers
5.3K+ views

Hi, recently our company has updated development laptops with windows 10. After Installing Visual Studio 2015 and telerik controls I receive below error:

Error  'Could not load file or assembly 'Telerik.Web.UI, Version=2016.3.1027.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER))'

However everything is working fine on old developer machine.

OS : Windows 10 Pro

IDE: Visual Studio 2015 Update 3

Telerik: 2016.3.1027.45

P.S - We do not have installed any previous version of Visual studio on new laptop.

 

 

Shubhra
Top achievements
Rank 1
 answered on 23 Oct 2019
2 answers
139 views

how can we search the items list like a regualar dropdown :

ddl.SelectedIndex = ddl.Items.IndexOf(cbxPractitionerList.Items.FindByValue("X");

david
Top achievements
Rank 1
 answered on 22 Oct 2019
3 answers
175 views

Hi to all,

it is possible to get the clicked button of a radprompt?

I try to check if the OK Button is clicked and the Textbox left blank to call another Alert with an error message.

My problem is that when i clicked the CANCEL Button i get the NULL Value and when i left blank the textbox and click the OK Button then i also geht the NULL Value.

    <script type="text/javascript">  
 
        function openPrompt(TitleText, Text, IText, IIndex) {  
            document.getElementById("<%= hdnIIndex.ClientID %>").value = IIndex;  
            radprompt(Text + '<br style="clear:both" /><strong>' + IText + '</strong>', promptCallBackFn, 330, 100, null, TitleText, null);  
        }  
 
        function promptCallBackFn(arg) {  
 
            document.getElementById("<%= hdnText.ClientID %>").value = arg;  
            if (arg != null && arg != '') {  
                document.getElementById("Refresh").click();  
            }  
            else {  
                radalert('You have clicked OK, but the text is blank', 330, 100, 'Error Msg'); return false;  
            }  
        }  
 
    </script> 
Vessy
Telerik team
 answered on 22 Oct 2019
10 answers
1.4K+ views

Hello,

I manually enter the text to be filtered in the textbox and click on the filter icon.

However, the same records are still displayed.

What is going wrong with my grid?

Here is the GridBoundColumn for the Lastname:

<telerik:GridBoundColumn DataField="Driver.LastName"  DataType="System.String" HeaderText="Fahrer" UniqueName="DriverLastName"  AutoPostBackOnFilter="true" ShowFilterIcon="true" AllowFiltering="true"  >
                       </telerik:GridBoundColumn>

 

And here is the whole Radgrid:     

<telerik:RadGrid Height="100%" runat="server" ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource" AllowPaging="true" PageSize="12"
               Font-Size="Small" AutoGenerateColumns="False" Culture="de-DE" MasterTableView-CommandItemSettings-AddNewRecordText="Reisekostenerfassung"
               OnPreRender="RadGrid1_PreRender" OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand" OnDeleteCommand="RadGrid1_DeleteCommand" AllowFilteringByColumn="True" AllowSorting="True" >
               <MasterTableView DataKeyNames="OperationalTravelingExpensesId" runat="server" EditMode="PopUp" CommandItemDisplay="Top" ShowHeadersWhenNoRecords="true" AllowFilteringByColumn="True">
                   <Columns>
                       <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn>
                       <telerik:GridBoundColumn DataField="OperationalTravelingExpensesId" HeaderText="sdf" UniqueName="OperationalTravelingExpensesId" Display="false">
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Driver.LastName"  DataType="System.String" HeaderText="Fahrer" UniqueName="DriverLastName"  AutoPostBackOnFilter="true" ShowFilterIcon="true" AllowFiltering="true"  >
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Driver.DriverNumber" HeaderText="Personalnr." UniqueName="DriverPersonalNumber" >
                       </telerik:GridBoundColumn>
 
                       <%--<telerik:GridBoundColumn DataField="TravelingDate" HeaderText="Datum" UniqueName="TravelingDate" DataFormatString="{0:D}" >
                       </telerik:GridBoundColumn>--%>
 
                         <telerik:GridDateTimeColumn DataField="TravelingDate" HeaderText="Datum" FilterControlWidth="110px"
                           SortExpression="Datum" PickerType="DatePicker" EnableTimeIndependentFiltering="true"
                           DataFormatString="{0:D}">
                       </telerik:GridDateTimeColumn>
 
                       <telerik:GridBoundColumn DataField="StartTime" HeaderText="Beginn" UniqueName="StartTime" DataFormatString="{0:HH:mm}" AllowFiltering="false">
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="EndTime" HeaderText="Ende" UniqueName="EndTime" DataFormatString="{0:HH:mm}" AllowFiltering="false">
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Vehicle.LicencePlateNumber" HeaderText="Fahrzeug" UniqueName="VehicleLicencePlateNumber" AllowFiltering="false">
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Tour.TourNumber" HeaderText="Tour" UniqueName="TourTourNumber">
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Destination" HeaderText="Reiseziel" UniqueName="Destination" AllowFiltering="false">
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Subject" HeaderText="Anlass" UniqueName="Subject" AllowFiltering="false">
                       </telerik:GridBoundColumn>
                   </Columns>
                   <EditFormSettings UserControlName="TravelExpenses.ascx" EditFormType="WebUserControl">
                       <EditColumn UniqueName="EditCommandColumn1"/>
                   </EditFormSettings>
               </MasterTableView>
           <ClientSettings>
               <ClientEvents OnRowDblClick="RowDblClick" OnPopUpShowing="onPopUpShowing" />
           </ClientSettings>
   </telerik:RadGrid>

 

 

Attila Antal
Telerik team
 answered on 22 Oct 2019
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?