Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
51 views
I am using this sort of code in the fiddle given below.

http://jsfiddle.net/darrenarbell/4HTEr/

When editing the cell content ,the content value vanished.

I am not sure it's a bug or not ?How can i fix that?

Deeply appreciated your help.
Aaron
Top achievements
Rank 1
 asked on 01 Aug 2017
0 answers
131 views

I was trying to have the validation happening at client side by adding the OnCommand ClientEvents to the grid.  If invalid, the OnCommand will be cancelled.

 

However, after adding it in, it caused the Grid control to throw error "Unable to get property 'showInsertItem' of undefined or null reference" (can be viewed thru debug within IE).  This has caused the "Add new Record" button of the Grid not working.  If I take out the ClientEvents lines out, the affected function will be resumed.  The funny thing was that it seemed it only got problem with "OnCommand".  I tried few other, such as OnItemCreated, OnDoubleClick, without issues at all.

Any ideas?  Attached please find my code.

@ Control Language="C#" AutoEventWireup="false" CodeBehind="Data018_WRN_RecallQryByVin.ascx.cs"
    Inherits="HMSA.HinoConnect.UI.Web.CustomPageElements.Data018_WRN_RecallQryByVin" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<style type="text/css">
    .Dta018WrnRecallQdsp{
        color:red;
        width:100%;
    }
</style>

<script type="text/javascript">
    var searchedTxt = "";
    var hdnapiUrl;
    var hdnWebApiToken;

    function DspRadAjaxLoadingPanle(sender, _show) {
        var loadingPanel = $find("<%= Dta018WrnRecallQ_RadAjaxLoadingPanel.ClientID %>");

        if (_show) {
            loadingPanel.show(sender.get_id());
        }
        else {
            loadingPanel.hide(sender.get_id());
        }
    }//DspRadAjaxLoadingPanle

    function Dta018WrnRecallQEditTmpltVinRadcombo_RequestData(sender, eventArgs) {
        var _txt = sender.get_text();
        var _cnt = sender.get_items().get_count();

        //serial number must have length of 6 and last 5 are all numbers
        if (_txt.length != 6 || (searchedTxt == _txt && _cnt>0) || (_txt.length == 6 && !_txt.substring(1).match(/^\d+$/))) {
            eventArgs.set_cancel(true);
            return;
        }

        hdnWebApiToken = document.getElementById("<%=Dta018WrnRecallQ_webAPItoken.ClientID %>");
        hdnapiUrl = document.getElementById("<%=Dta018WrnRecallQ_apiUrl.ClientID %>");

        DspRadAjaxLoadingPanle(sender, true);

        $.ajax({
            url: hdnapiUrl.value + '/api/v1/Ids_infp07/GetVinBySearchToken/?SearchToken=' + _txt + '&DlrCode= &hmsastaff=Y',
            dataType: 'json',
            headers: {
                "Authentication": hdnWebApiToken.value
            },
            type: 'GET',
            contentType: "application/json;charset=utf-8",
            crossDomain: true,

            success: function (data, textStatus, xhr) {
                DspRadAjaxLoadingPanle(sender, false);

                sender.clearItems();
                var recCount = 0;
                searchedTxt = _txt;

                $.each(data, function (key, item) {
                    var comboItem = new Telerik.Web.UI.RadComboBoxItem();
                    var _vin = item._VIN_I7.trim();

                    comboItem.set_text(_vin);
                    comboItem.set_value(_vin);
                    sender.get_items().add(comboItem);
                    recCount++;
                });

                if (recCount > 0) {
                    sender.showDropDown();
                }
                return;
            },
            error: function (error, status, xhr) {
                DspRadAjaxLoadingPanle(sender, false);

                searchedTxt = '';
                var _ermsg = "error: ";

                if (error) {
                    if (error.responseText) {
                        _ermsg = _ermsg + error.responseText;
                    }
                }

                _ermsg = _ermsg + "; status: ";

                if (status) {
                    _ermsg = _ermsg + status;
                }

                _ermsg = _ermsg + "; xhr: ";

                if (xhr) {
                    _ermsg = _ermsg + xhr;
                }

                alert(_ermsg);

                return;
            }
        });//ajax

        eventArgs.set_cancel(true);
    }//Dta018WrnRecallQEditTmpltVinRadcombo_RequestData
</script>

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function RaiseCommand(sender, eventArgs) {
                
                alert("Hi");
            }
        </script>
</telerik:RadCodeBlock>

<asp:PlaceHolder ID="ViewPlaceHolder" runat="server" Visible="false">
    <p>
        View mode</p>
    <asp:Label ID="SampleOutput" runat="server"></asp:Label>

    <div class="row">
            <p id="Dta018WrnRecallQ_radgrd_divMsgs" runat="server">
                <asp:Label ID="Dta018WrnRecallQ_radgrd_divMsgs_lbl1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080">
                </asp:Label>
                <asp:Label ID="Dta018WrnRecallQ_radgrd_divMsgs_lbl2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000">
                </asp:Label>
            </p>
    </div> 

    <telerik:RadAjaxLoadingPanel runat="server" ID="Dta018WrnRecallQ_RadAjaxLoadingPanel" />

    <telerik:RadAjaxManager runat="server" ID="Dta018WrnRecallQ_radajaxmgr" DefaultLoadingPanelID="Dta018WrnRecallQ_RadAjaxLoadingPanel" ClientEvents-OnRequestStart="mngRequestStarted">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Dta018WrnRecallQ_radgrd">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Dta018WrnRecallQ_radgrd" LoadingPanelID="Dta018WrnRecallQ_RadAjaxLoadingPanel"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="Dta018WrnRecallQ_radgrd_divMsgs"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>           
    </telerik:RadAjaxManager>

    <telerik:RadFormDecorator RenderMode="Lightweight" ID="Dta018WrnRecallQ_RadFormDecorator" runat="server" DecorationZoneID="Dta018WrnRecallQ_demo" DecoratedControls="All" EnableRoundedCorners="false" />

    <div id="Dta018WrnRecallQ_demo" class="demo-container no-bg">
        <telerik:RadGrid RenderMode="Lightweight" runat="server" ID="Dta018WrnRecallQ_radgrd" AutoGenerateColumns="false" AllowPaging="true" Skin="Silk"
             Width="40%" style="margin-left: auto !important; margin-right: auto !important;" OnNeedDataSource="Grid_NeedDataSource" OnUpdateCommand="Grid_UpdateCommand" 
            OnInsertCommand="Grid_UpdateCommand">
                    
            <MasterTableView CommandItemDisplay="Top" DataKeyNames="Vin" ClientDataKeyNames="Vin" InsertItemPageIndexAction="ShowItemOnLastPage">
                <CommandItemSettings AddNewRecordText="Add New Vin#" ShowRefreshButton="false" />
                
                <Columns>                       
                    <telerik:GridBoundColumn DataField="Vin" HeaderText="Vin #" ReadOnly="true"
                            ForceExtractValue="Always" ConvertEmptyStringToNull="true" />                 
                    <telerik:GridEditCommandColumn UniqueName="Dta018WrnRecallQ_GridEditCommandColumn" ButtonType="ImageButton"/>                  
                </Columns>

                <EditFormSettings EditFormType="Template">
                    <FormTemplate>
                        <table id="Dta018WrnRecallQ_edit_form_tmplt" style="border-collapse: collapse; border-spacing: 2px; padding: 1px; width: 100%; border-style:hidden;">
                            <tr>
                                <td>Vin #:</td>
                                <td>
                                    <telerik:radcombobox id="Dta018WrnRecallQ_edit_form_tmplt_vin" runat="server" Text='<%# Bind("Vin") %>' TabIndex="1" Width="100%"
                                        datatextfield="text" datavaluefield="value" AllowCustomText="true" EmptyMessage="Type serial number to search..."
                                        MarkFirstMatch="true" EnableLoadOnDemand="true" OnClientItemsRequesting ="Dta018WrnRecallQEditTmpltVinRadcombo_RequestData"/>
                                </td>
                                <td>
                                    <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button> &nbsp;
                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                                </td>
                            </tr>       
                        </table>
                    </FormTemplate>
                </EditFormSettings>
            </MasterTableView>
            
            <PagerStyle Mode="NextPrevAndNumeric" />   
            
            <ClientSettings>
                <ClientEvents OnCommand="RaiseCommand" />
            </ClientSettings>    
        </telerik:RadGrid><%--Dta018WrnRecallQ_radgrd--%>

        <label id="Dta018WrnRecall_grid_err" runat="server" class="Dta018WrnRecallQdsp">err</label> 
    </div><%--Dta018WrnRecallQ_demo--%>

    <asp:HiddenField ID="Dta018WrnRecallQ_apiUrl" runat="server"/>
    <asp:HiddenField ID="Dta018WrnRecallQ_webAPItoken" runat="server"/>
</asp:PlaceHolder><%--ViewPlaceHolder--%>

<asp:PlaceHolder ID="EditPlaceHolder" runat="server" Visible="false">
    <p>
        Edit mode (this is an optional mode in case you want publishers to be able to edit
        and save settings for this element).</p>
    Setting :
    <asp:TextBox ID="SampleSetting" runat="server" />
</asp:PlaceHolder>

Jack
Top achievements
Rank 1
 asked on 01 Aug 2017
0 answers
184 views

I am using a RadGrid popup form.  Due to the amount of data in the grid row, the edit popup for has three controls.  One control is a Rad combobox to select the field to edit.  Two text boxes exist.  One text box is for the current field value in the database.  Another text box is for the new value entered by the user.  The problem is edit popup is not working correctly.  The popup has no background color (it is clear).  That the rad grid item data bound event is called for each post back.  The edit popup form current item text box is blank.  The rad combobox does not retain its values across post backs.  The rad combobox also does not keep its selected value across post backs.  I have tried both a user control popup form and a form template within the radgrid.  No errors are given.  The form does not work correctly.  The text box values are all set based on the radcombobox selected value in the code behind.  No data binding is taking place.  The program I inherited is using similar code on another web page.  My new page is different.  The new page has five grids.  One parent grid.  The other grid's data is determined by the row selected in the parent grid.

Telerik RadControls for ASP.NET AJAX Q2 2011 SP1 is installed on the windows 7 computer.  My website is C# asp.net web forms (.net framework 4).  My browser is Internet Explorer 11.  Any advice is greatly appreciated.  I am not able to attach my code or past it in this thread.

Ed
Top achievements
Rank 1
 asked on 31 Jul 2017
8 answers
112 views

Hi, is there a way to produce something similar to the following

https://resourcetrade.earth/data ?

Thank you

David
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 31 Jul 2017
1 answer
168 views

We are trying to display a distribution line chart.  Behind it, we would like shaded areas to indicate P10, 25,50,75, 90 similar to the rough sketch below.  How would we accomplish that background shading with htmlchart?

 

Thanks.

Marin Bratanov
Telerik team
 answered on 31 Jul 2017
1 answer
86 views

This works:

 

   <ResourceTypes>
                <telerik:ResourceType KeyField="id" Name="Vragenset" TextField="description" ForeignKeyField="VragensetID"
                    DataSourceID="sds_vragenset"></telerik:ResourceType>

                      <telerik:ResourceType KeyField="id" Name="Project" TextField="description" ForeignKeyField="ProjectID"
                    DataSourceID="sds_project"></telerik:ResourceType>

            </ResourceTypes>

 

But this is not working:

 

   <ResourceTypes>
                <telerik:ResourceType KeyField="id" Name="VragensetID" TextField="description" ForeignKeyField="VragensetID"
                    DataSourceID="sds_vragenset"></telerik:ResourceType>

                      <telerik:ResourceType KeyField="id" Name="ProjectID" TextField="description" ForeignKeyField="ProjectID"
                    DataSourceID="sds_project"></telerik:ResourceType>

            </ResourceTypes>

 

Mind that I names the Name the same as ForeignKeyField. Is this a bug or by design?

 

Marc

Rumen
Telerik team
 answered on 31 Jul 2017
2 answers
561 views

I am troubleshooting a program that someone else wrote and there is a grid that is missing a few column headers upon export to excel.  The column headers and data showed up on screen but not on excel export.  The first few columns would have headers and the rest of the columns displayed data but no headers.  In the method that gets called by OnItemCommand, I have tried changing the header text by doing this:

gridMasterTableView.GetColumn(I).HeaderText = I;

but it doesn't seem to change anything on the excel.

In the method that is called by OnItemDataBound I tried to put a breakpoint on this line:

GridHeaderItem header = (GridHeaderItem)e.Item;

In the GridHeaderItem I noticed it only has a few of the columns.

I just want to fill the missing column headers.  Is there a good place where I can access the datatable that gets exported to excel and put in the headers?  In other words, if I only want to control what column name to put on excel export without touching the original source data, what would be a good place to do it and how to go about doing that?

Thanks.

Eyup
Telerik team
 answered on 31 Jul 2017
0 answers
74 views

We have a project that we store the connection string in a session (in page load).

When using the radscheduler reminder function it works for the first time but after that the Scheduler stops functioning and returns the error that connection string has not been initialized. Keep in mind we cannot change the way we use the connection string and we need to keep it stored in the session.

Has anyone faced the above problem before? Thanks in advance

MICHAEL
Top achievements
Rank 1
 asked on 31 Jul 2017
1 answer
1.0K+ views

I am trying to bind a List as the database for my RadGrid and I am getting the following error "Cannot find any bindable properties in an item from the datasource" although I have made sure and tested that the data source is returning valid data.

<telerik:RadGrid ID="grdTest" runat="server"  AutoGenerateColumns="true" ShowStatusBar="True" OnNeedDataSource="grdTest_NeedDataSource" >
    <MasterTableView AutoGenerateColumns="true" >
    </MasterTableView>
</telerik:RadGrid>

 

protected void grdTest_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    int ParentRulCode = 2611767;
    List<Enrolment> MyEnrol = EnrolmentRepository.GetChildEnrolmentsFromRulCode(ParentRulCode);
 
    grdTest.DataSource = MyEnrol;
}

 

 

Here is My Enrolment Class

public class Enrolment
{
    public Course MC;
    public Person MP;
    public int RulCode;
    public DateTime StartDate;
    public DateTime EndDate;
    public string ProgressStatus;
}
Eyup
Telerik team
 answered on 31 Jul 2017
0 answers
66 views
Need to bind the asp.net grid in AdvancedInsertTemplate .
arun
Top achievements
Rank 1
 asked on 31 Jul 2017
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?