Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
373 views

I have been struggling to get the callback function to be recognized.  My situation is that I have a javascript function that executes when a user clicks a button.  This function contains code similar to the following to open the radconfirm prompt window

 var oManager = GetRadWindowManager();
    oManager.radconfirm(pMsg, "returnFunction",400,300,"Popup Title");

 

When the user clickes either the Ok or Cancel button the following error occurs.

JavaScript runtime error: Function expected

 

The function returnFunction(arg) exsits in the same javascript file but is not recognized.

Any ideas as to the issue.

 

Andy
Top achievements
Rank 1
Iron
 answered on 06 Aug 2018
1 answer
144 views

I would like to be able to remove formatting when pasting into the spreadsheet control. I have followed the recommendation on this article.

https://docs.telerik.com/devtools/aspnet-ajax/controls/spreadsheet/how-to/pasting-data-only

However, this._content is always undefined.

What am I missing? I am using version 2016.2.607.45

Marin Bratanov
Telerik team
 answered on 06 Aug 2018
3 answers
424 views
I am looking into your editor HTML to PDF conversion demo: http://demos.telerik.com/aspnet-ajax/editor/examples/pdfexport/defaultcs.aspx and converting the editor to PDF only converts the visible content. If you scroll further down the editor content, you placed a table with browser info and graphics in it, but this data does not render to the pdf, Why?
Is this the only example you have on your site?
Is the pdf conversion tool unable to convert form elements (checkboxes, textboxes) into pdf?
What HTML elements can the generator convert to pdf?
Rumen
Telerik team
 answered on 06 Aug 2018
5 answers
266 views
I have a GridHyperLinkColumn in my radgrid that is used to link to a SSRS report on a per-row basis - I would like to add a header link button that allows the users to execute a report that generates a report of all row items (1 record per-page).  To my mind setting the HeaderImageUrl and HeaderButtonType to LinkButton should result in a HyperLink control being rendered in the header cell however that is not the case - all I get is a Image control with the referenced image I set.  It appears that setting the HeaderButtonType has no effect so I'm wondering what column types is this property valid for as it does not seem to be valid for a GridHyperLinkColumn.  Obviously I could use a template column but I thought if I could use the properties provided (HeaderImageUrl/HeaderButtonType) life could be much simpler - that appears to not be the case.

<telerik:GridHyperLinkColumn UniqueName="MemoColumn" ImageUrl="Content/Images/memo16.png" Target="_blank"
                                    HeaderImageUrl="Content/Images/memo16.png" HeaderButtonType="LinkButton">
                                    <ItemStyle HorizontalAlign="Center" Width="3%" Wrap="false" />
                                    <HeaderStyle HorizontalAlign="Center" Width="3%" />
                                </telerik:GridHyperLinkColumn>
Eyup
Telerik team
 answered on 06 Aug 2018
3 answers
411 views

I have a link button in my RadGrid. When I clicked the link button,it will pop out a new page. All is working fine without error. Here is my code:


ASP
<telerik:RadGrid ID="gvCustomer" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Width="100%">
        <MasterTableView AllowMultiColumnSorting="True">
            <CommandItemSettings ExportToPdfText="Export to PDF" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" HeaderText="Customer Name"
                    SortExpression="CUSTOMERNAME" UniqueName="TemplateColumn">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkCustomerName" runat="server" CommandArgument='<%#Eval("CUSTOMERNAME") "," +Eval("IC")+ "," +Eval("ACCNO")%>' 
   CommandName="command" Font-Underline="True" Text='<%# Bind("CUSTOMERNAME") %>'>
 </
asp:LinkButton>
                    </ItemTemplate>
                    <FooterStyle HorizontalAlign="Center" />
                    <HeaderStyle Width="25%" />
                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" />
                </telerik:GridTemplateColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
            <PagerStyle AlwaysVisible="True" />
        </MasterTableView>
        <HeaderStyle HorizontalAlign="Center" />
        <PagerStyle AlwaysVisible="True" />
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
</telerik:RadGrid>

VB.NET
Protected Sub gvCustomer_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles gvCustomer.ItemCommand
 
       If e.CommandName = "command" Then
           Dim arg As String() = e.CommandArgument.ToString.Split(",")
           Dim strName As String = arg(1)
           Dim strIC As String = arg(2)
           Dim strAccountNo As String = arg(3)
 
           Dim str As String
           str = "<script language='javascript'>window.open(' " + "~/Customer.aspx?CustomerName=" & strName & "&OldIC=" & strIC & "&AccountNo=" & strAccountNo + " ');</script>"
           ClientScript.RegisterStartupScript(Me.GetType(), "script", str)
       End If
   End Sub

But after I added the RadAjaxManager to handle the RadGrid. The link button is not working anymore. The new page does not pop out. But if I remove the ajax manager will work fine,the page is post back and new page is pop out. Below is the code I added:


ASP
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="gvCustomer">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="gvCustomer" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
</telerik:RadAjaxManager>

Please help me to find out the solution.Thank you very much!
Attila Antal
Telerik team
 answered on 06 Aug 2018
4 answers
108 views

I have implemented RadGrid in my project for displaying data. But facing one severe issue, when trying to post back or going to the next page, the pager control is shifting down. In order to fix Grid height and width according to the page height and width, i have implemented bellow java script in page load. But unfortunately after post back it is not working.

                   var grid, gridHeight;
                   gridHeight = document.documentElement.offsetHeight - 130;
                   grid = $find('<%= GridControl1.FindControl("RadGrid4").ClientID %>');
                   if(grid !== null){
                        contentPane.set_height(document.documentElement.offsetHeight - 90);  
                        grid.get_element().style.height = gridHeight+ "px";
                        contentSplitter.repaint();
                        grid.repaint();
                    }
                    else{
                        contentPane.set_height(document.documentElement.offsetHeight - 75);
                    }

Kindly suggest, how to fix Grid height in post back so that pager control should not shift down or disappear.

Thanks in advance.

Dipak

Eyup
Telerik team
 answered on 06 Aug 2018
1 answer
146 views

Hi,

We are currently evaluating the use of radgrids inside a radwizard to create a wizard that needs to collect validated data during entry in tables and that needs to send the collected info to a process at the last page of the wizard (classic behavior).

The idea seems mainstream but the use of grids and grids inside a wizard is not so easy.

Here is some problems we are facing:

1)We use fully client side radgrids: their initial data is populated by passing them empty lists of objects as a DataSource.
Rows can then be added manually using a button which triggers a 'fireCommand("InitInsert", "")'. 
The users can batch edit the cells.  
Can your please provide a working exemple of a RadGrid properly set up to be used fully client side and of the proper way to get its client values?

2)We tried setting ClientDataKeyNames to get the RadGrids data more easily: manually created rows with InitInsert, even when data has been entered manually, always provide empty values using getDataKeyValue("xxx") on the row.
Which is understandable as no data is actually bound.
How to properly get data from a RadGrid which is used this way?
As for now, we get the cells with js and search them for values. :(

3)Rows can also be added programmatically. Rows containGridTemplateColumns with DropDownList EditItemTemplate: How to programmatically set a RadDropDownList value in a client side RadGrid?
<telerik:GridTemplateColumn  UniqueName="UserLanguage" SortExpression="UserLanguage" HeaderText="UserLanguage" DataField="UserLanguage" ShowFilterIcon="false" 
EditFormColumnIndex="4" ColumnEditorID="CompanyListColumnEditor">
<HeaderStyle Width="50px" />
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "UserLanguage")%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadDropDownList RenderMode="Lightweight" ID="UserLangDD1" runat="server"  Width="200px">
<Items>
<telerik:DropDownListItem Value="0" />
<telerik:DropDownListItem Value="F" Text="Français" />
<telerik:DropDownListItem Value="E" Text="English" />
</Items>
</telerik:RadDropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>
I guess the problem resides in DataBinder.Eval() as no data is actually bound to the grid.
We tried setting UserLanguage with the display value ("Français" or "English") which does not work.
We tried to set UserLangDD1 with the Value (F or E) which does not work either.

4) The radWizard's Steps contain also other controls which are part of a validation group for each Step.
The validation works for these controls but does not apply to the fields of the rows which have been added to the Radgrids, despite these Column have as well Validators referencing the same ValidationGroup as the controls outside the Grids.
How to make a RadWizardStep apply RequiredFieldValidator on Grid Columns of RadGrids that it contains?

5) In a RadGrid, how not to block the user to getting out of a cell containing a Required control which has not yet been filled?
Currently, when a required control of a grid is not filled, it is forbidden to edit another control of these row, is there a workaround?

6) How to properly make a batch editable GridBoundColumn launch a popup (or equivalent) with a list of checkboxes as potential values and disallow users to actually write in this cell?

Any direction will be highly appreciated!

 

 

Daniel
Top achievements
Rank 1
 answered on 06 Aug 2018
6 answers
327 views
Just like in title, I am using TextBox set as numeric. I would like to translate error messages like "Please  enter a number."
Jacek
Top achievements
Rank 1
 answered on 03 Aug 2018
1 answer
304 views

Hi, 

if I have an excel-like filter with a few items selected as shown in the attached image, is there any way to programmatically unselect all the values from the listbox? I am using this code to explicitly clear the filter and it works for clearing the radgrid but it does not clear the filter listbox selections:

 

foreach (GridColumn column in grid.MasterTableView.Columns)           

 {                

       column.CurrentFilterFunction = GridKnownFunction.NoFilter;               

        column.CurrentFilterValue = string.Empty;           

 }            

grid.MasgterTableView.FilterExpression = string.Empty;            

grid.Rebind();

Eyup
Telerik team
 answered on 03 Aug 2018
1 answer
104 views

Hi there,

     First let me show you my code first,

<!-- Page Content Body -->
    <div class="content mt-3">
        <div class="animated fadeIn">
            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <h4>Language Settings</h4>
                        </div>
                        <div class="card-body">
                            <div class="row form-group">
                                <asp:Panel CssClass="col-sm-12" ID="pnlMessage" runat="server">
                                    <div class="alert  alert-success alert-dismissible fade show" role="alert">
                                        <span class="badge badge-pill" id="message_header"> <!-- add badge-[type] for changing notification style -->
                                            <asp:Label runat="server" ID="lbl_type"></asp:Label></span>
                                        <asp:Label runat="server" ID="lblMessage"></asp:Label>
                                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                            <span aria-hidden="true">×</span>
                                        </button>
                                    </div>
                                </asp:Panel>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-6">
                                    <div class="row">
                                        <div class="col-md-5">
                                            <asp:Label ID="label" AssociatedControlID="txt_languageName" Text="Enter language Name" runat="server" />
                                        </div>
                                        <div class="col-md-7">
                                            <telerik:RadTextBox runat="server" ID="txt_languageName" Skin="Glow" RenderMode="Lightweight" Width="100%">
                                                <EnabledStyle BackColor="#FFFFFF" ForeColor="Black"></EnabledStyle>
                                                <FocusedStyle BackColor="Black" ForeColor="#FFFFFF"></FocusedStyle>
                                                <HoveredStyle BackColor="Black" ForeColor="#FFFFFF"></HoveredStyle>
                                            </telerik:RadTextBox>
                                            <small class="form-text text-muted hide_me">This is a help text</small>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="row">
                                        <div class="col-md-5">
                                            <asp:Label ID="label1" AssociatedControlID="txt_langCode" Text="Enter language Code" runat="server" />
                                        </div>
                                        <div class="col-md-7">
                                            <telerik:RadTextBox runat="server" ID="txt_langCode" Width="100%" Skin="Glow" RenderMode="Lightweight">
                                                <EnabledStyle BackColor="#FFFFFF" ForeColor="Black"></EnabledStyle>
                                                <FocusedStyle BackColor="Black" ForeColor="#FFFFFF"></FocusedStyle>
                                                <HoveredStyle BackColor="Black" ForeColor="#FFFFFF"></HoveredStyle>
                                            </telerik:RadTextBox>
                                            <small class="form-text text-muted hide_me">This is a help text</small>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- second row -->
                            <div class="row form-group">
                                <div class="col-md-6">
                                    <div class="row">
                                        <div class="col-md-5">
                                            <asp:Label ID="label2" AssociatedControlID="txt_languageName" Text="Enter Culture Code" runat="server" />
                                        </div>
                                        <div class="col-md-7">
                                            <telerik:RadTextBox runat="server" ID="txt_culture_code" Skin="Glow" RenderMode="Lightweight" Width="100%">
                                                <EnabledStyle BackColor="#FFFFFF" ForeColor="Black"></EnabledStyle>
                                                <FocusedStyle BackColor="Black" ForeColor="#FFFFFF"></FocusedStyle>
                                                <HoveredStyle BackColor="Black" ForeColor="#FFFFFF"></HoveredStyle>
                                            </telerik:RadTextBox>
                                            <small class="form-text text-muted hide_me">This is a help text</small>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="row">
                                        <div class="col-md-5">
                                            <asp:Label ID="label3" AssociatedControlID="txt_isoValue" Text="Enter ISO Code" runat="server" />
                                        </div>
                                        <div class="col-md-7">
                                            <telerik:RadTextBox runat="server" ID="txt_isoValue" Width="100%" Skin="Glow" RenderMode="Lightweight">
                                                <EnabledStyle BackColor="#FFFFFF" ForeColor="Black"></EnabledStyle>
                                                <FocusedStyle BackColor="Black" ForeColor="#FFFFFF"></FocusedStyle>
                                                <HoveredStyle BackColor="Black" ForeColor="#FFFFFF"></HoveredStyle>
                                            </telerik:RadTextBox>
                                            <small class="form-text text-muted hide_me">This is a help text</small>
                                        </div>
                                    </div>
                                </div>
                            </div>
 
                            <!-- third row -->
                            <div class="row form-group">
                                <div class="col-md-12 headerClass">
                                    <div class="btn-group">
                                        <asp:Button runat="server" ID="btnSave" Text="Save" Width="53%" OnClick="btnSave_OnClick" CssClass="w3-btn" />
                                        <asp:Button runat="server" ID="btnSearch" Text="Search" Width="53%" OnClick="btnSearch_OnClick" CssClass="w3-btn" />
                                    </div>
                                </div>
                            </div>
 
                            <!-- show hide radgrid -->
                            <div class="row form-group">
                                <div class="col-md-12">
                                    <telerik:RadGrid runat="server" ID="radGridLanguage" AutoGenerateColumns="False" BorderStyle="None" AllowPaging="True"
                                        AllowSorting="True" OnItemCommand="radGridLanguage_ItemCommand" PageSize="10" RenderMode="Lightweight" Skin="Glow"
                                        Style="margin-top: 1%; width: 98%; font-size: 13px">
                                        <MasterTableView AllowFilteringByColumn="True" NoMasterRecordsText="No language data found" Height="10px" BackColor="#272c33" FilterItemStyle-BorderColor="white">
                                            <Columns>
                                                <telerik:GridBoundColumn DataField="lang_name" FilterControlAltText="Filter column column" HeaderText="Language Name" UniqueName="column" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="culture_name" FilterControlAltText="Filter column1 column" HeaderText="Culture Name" UniqueName="column1" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="culture_code" FilterControlAltText="Filter column2 column" HeaderText="Culture Code" UniqueName="column2" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="iso_639x_value" FilterControlAltText="Filter column3 column" HeaderText="ISO Value" UniqueName="column3" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridTemplateColumn HeaderText="Action" AllowFiltering="false">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblLangAutoId" Text='<%#Eval("autoid") %>' runat="server" Visible="false"></asp:Label>
                                                        <asp:ImageButton ID="imgBtnDelLanguage" runat="server" Width="20px" ImageUrl="~/Images/delete.png" OnClick="imgBtnDelLanguage_OnClick" OnClientClick="return confirm('want to delete?');" />
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                            </Columns>
                                        </MasterTableView>
                                        <PagerStyle Mode="NextPrevAndNumeric" />
                                        <GroupingSettings CollapseAllTooltip="Collapse all groups" />
                                        <HeaderStyle BackColor="#272c33" Font-Bold="True" BorderColor="white" />
                                    </telerik:RadGrid>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
 
    <!-- set ajaxify -->
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="lp" ShowLoadingPanelForPostBackControls="True" UpdatePanelsRenderMode="Inline">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="radGridLanguage" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadAjaxLoadingPanel ID="lp" runat="server" Transparency="30" MinDisplayTime="300" EnableEmbeddedSkins="False">
        <div class="loading">
            <asp:Image ID="Image1" runat="server" ImageUrl="../../Images/loading-default.gif" AlternateText="loading"></asp:Image>
        </div>
    </telerik:RadAjaxLoadingPanel>

 

Now as you could see, I have four text box controls two button controls(Save,Search) and one grid and one panel control present in page.

Flow:

 Now as mentioned previously two buttons are save and search.

  1.  When User fill up the form and click on Save button data will store into database and after that panel will be popped up describing status message.(done)
  2.  Now, while user clicks on Search button grid will appear. (done)
  3. Now while user clicks on the delete button, data gets deleted , but that panel is not showing up.(Not Done)
  4. After clicking on the delete button I want to reset my controls (textbox) . (Not done)
 
protected void btnSave_OnClick(object sender, EventArgs e)
        {
            pnlMessage.Visible = true;
            _objBelAdministration.flag = "insert";
            _objBelAdministration.strLanguageName = txt_languageName.Text.Trim();
            _objBelAdministration.strCultureName = txt_langCode.Text.Trim();
            _objBelAdministration.strCultureCode = txt_culture_code.Text.Trim();
            _objBelAdministration.strIsoValue = txt_isoValue.Text.Trim();
            if ((_objBlAdministration.InsertLanguageInfo(_objBelAdministration)) > 0)
            {
                lbl_type.Text = "Sucess";
                lblMessage.Text = "Sucessfully inserted into database";
                ScriptManager.RegisterStartupScript(this.Page, typeof(Type), "alert01", "addClassSucess();", true);
            }
            else
            {
                lbl_type.Text = "Failure!";
                lblMessage.Text = "Problem while inserting into database";
                ScriptManager.RegisterStartupScript(this.Page, typeof(Type), "alert012", "addClassDanger();", true);
            }
            GetLanguages();
        }
 
 
 
protected void imgBtnDelLanguage_OnClick(object sender, ImageClickEventArgs e)
        {
            pnlMessage.Visible = true;
            var button = (ImageButton)sender;
            var item = (GridDataItem)(button.NamingContainer);
            _objBelAdministration.flag = "delete";
            _objBelAdministration.autoid = ((Label)(item.FindControl("lblLangAutoId"))).Text;
            if (_objBlAdministration.DeleteLanguageInfo(_objBelAdministration) > 0)
            {
                lbl_type.Text = "Sucess";
                lblMessage.Text = "Deleted from database";
                ScriptManager.RegisterStartupScript(this.Page, typeof(Type), "alert01", "addClassSucess();", true);
            }
            else
            {
                lbl_type.Text = "Error";
                lblMessage.Text = "Error ocured when Deleting from database";
                ScriptManager.RegisterStartupScript(this.Page, typeof(Type), "alert01", "addClassSucess();", true);
            }
            ResetControls();
            GetLanguages();
        }
 
        private void ResetControls()
        {
            txt_languageName.Text = "";
            txt_langCode.Text = "";
            txt_culture_code.Text = "";
            txt_isoValue.Text = "";
        }

 

 

 

 

 

 

Eyup
Telerik team
 answered on 03 Aug 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?