Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
198 views
 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test003.aspx.cs" Inherits="Test003" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="rsmMain"></telerik:RadScriptManager>
        <telerik:RadClientDataSource
            runat="server"
            ID="DS1"
            AllowPaging="true"
            EnableServerSorting="true"
            EnableServerFiltering="true"
            EnableServerPaging="true"
        >
        <DataSource>
            <WebServiceDataSourceSettings>
                <Select EnableCaching="false" Url="../api/test"  RequestType="Post" />
            </WebServiceDataSourceSettings>
        </DataSource>
        <Schema>
            <Model ID="Id">
                <telerik:ClientDataSourceModelField FieldName="Id" DataType="Number"  />
                <telerik:ClientDataSourceModelField FieldName="Name" DataType="String" />
                <telerik:ClientDataSourceModelField FieldName="Category" DataType="String" />
                <telerik:ClientDataSourceModelField FieldName="Price" DataType="Number" />
            </Model>
        </Schema>
        <ClientEvents
                OnRequestEnd="OnRequestEnd"
                OnDataParse="OnDataParse"
                OnCountRequested="OnCountRequested"
            />
    </telerik:RadClientDataSource>
    <br />
    <telerik:RadGrid runat="server" ID="rgMain"
         RenderMode="Lightweight"
         ClientDataSourceID="DS1"
         AllowMultiRowSelection ="true"
         AllowSorting="True"
         AllowPaging="True"
         PageSize="100"
         AutoGenerateColumns="false"
         AllowFilteringByColumn="true"
        >
        <MasterTableView AutoGenerateColumns="false" ClientDataKeyNames="Id" HierarchyLoadMode="Client">
            <Columns>
                <telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Id"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Category" HeaderText="Category" UniqueName="Category"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Price" HeaderText="Price" UniqueName="Price"></telerik:GridBoundColumn>
            </Columns>
            <PagerStyle AlwaysVisible="true" Mode="NextPrevNumericAndAdvanced" />
            <NestedViewTemplate>
                <asp:Literal runat="server" ID="Test">TEST</asp:Literal>
            </NestedViewTemplate>
        </MasterTableView>
        <ClientSettings>
            <ClientEvents OnCommand="OnGridCommand" OnGridCreated="OnGridCreated" OnDataBinding="OnDataBinding" OnDataBound="OnDataBound" />
        </ClientSettings>
    </telerik:RadGrid>
    <br />
    <telerik:RadCodeBlock runat="server" ID="rcbTest">
        <script type="text/javascript">
            var gcId = "";
            var countRg = 20;
            OnRequestEnd = function (sender, args) {
                console.log('OnRequestEnd');
                //console.log(sender);
                //console.log(args);
            }
            OnDataParse = function (sender, args) {
                console.log('OnDataParse');
                var response = args.get_response();
                countRg = response.count;
                if (response) {
                    args.set_parsedData(response.Data);
                }
            }
            OnCountRequested = function (sender, args) {
                args.set_countField(countRg);
                console.log('OnCountRequested');
            }
            OnGridCommand = function(sender, args) {
                if (args.get_commandName() == "Page")
                    console.log("Page Index Changed");
                else if (args.get_commandName() == "PageSize") {
                    args.set_cancel(true);
                    if (args.get_tableView().get_pageSize() > 50) {
                        args.get_tableView().set_pageSize(50)
                        console.log("Page Size Changed BIG");
                    }
                    console.log("Page Size Changed");
                }
                else {
                    console.log('COMMAND:' + args.get_commandName());
                }
                     
            }
            OnGridCreated = function (sender, args) {
                gcId = sender.get_id();
                console.log('Grid Created');
                var mtv = sender.get_masterTableView();
                mtv.set_pageSize(20);
            }
            OnDataBinding = function (sender, args) {
                console.log('OnDataBinding');
            }
            OnDataBound = function (sender, args) {
                console.log('OnDataBound');
            }
        </script>
    </telerik:RadCodeBlock>
    </form>
</body>
</html>

 

 

Is a part of my code.
When I filtring allways ask twice. 
On start asks triple time.
When I showing Comand Panel and clikd Refresh asking four times.

 

What i Do wrong, any sugestion.

 

 

Attila Antal
Telerik team
 answered on 01 Feb 2018
0 answers
119 views
I noticed that when using Mobile Rendering in RadGrid, that the Filterlist I had create does not work.  Instead it does the generic filtering with the mobile view.  Do I take it that Filterlist is not supported in RadGrid when using Mobile rendering?
David
Top achievements
Rank 2
 asked on 01 Feb 2018
2 answers
239 views

I have grouping in my grid and want to be able to expand multiple groups but I am able to expand only one group at a time.

<telerik:RadGrid ID="rgQ1CashValues" runat="server" DataSourceID="dataSrcMonthlyCashValues" EnableViewState="false"
                    OnPreRender="grid_PreRender" OnItemCommand="grid_ItemCommand" OnItemDataBound="grid_ItemDataBound"
                    OnItemCreated="grid_ItemCreated" >
                    <MasterTableView TableLayout="Fixed" CommandItemDisplay="Top" DataSourceID="dataSrcMonthlyCashValues"
                        Name="Q1CashValuesSummary" EnableNoRecordsTemplate="true" DataKeyNames="carriername" ShowGroupFooter="true" GroupsDefaultExpanded="false">
                        <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" ShowExportToExcelButton="true"
                            ExportToExcelText="" ExportToPdfText="" ShowExportToPdfButton="true" />
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldAlias="" HeaderText=" " HeaderValueSeparator=""
                                        FieldName="carriername" ></telerik:GridGroupByField>
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="carriername"></telerik:GridGroupByField>
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <Columns>
                            <telerik:GridBoundColumn  DataField="fullname" HeaderText="Participant" UniqueName="fullname"
                                 ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" FooterStyle-HorizontalAlign="Left">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="policynumber" UniqueName="PolicyNumber" HeaderText="Policy No"
                                 HeaderStyle-Width="8%" SortExpression="policynumber">
                            </telerik:GridBoundColumn>
                            <telerik:GridDateTimeColumn DataField="issuedate" UniqueName="PolicyDate" HeaderText="Policy Date"
                                SortExpression="issuedate" HeaderStyle-Width="8%" DataFormatString="{0:d}">
                            </telerik:GridDateTimeColumn>
                            <telerik:GridBoundColumn Aggregate="Sum" DataField="JanEnd" HeaderText="January" DataFormatString="{0:c2}"
                                HeaderStyle-Width="11%" >
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                    <GroupingSettings RetainGroupFootersVisibility="true" GroupContinuesFormatString="" GroupContinuedFormatString="" GroupSplitDisplayFormat="showing {0} of {1} participants" />
                </telerik:RadGrid>
MBEN
Top achievements
Rank 2
Veteran
 answered on 31 Jan 2018
13 answers
782 views
Using the Q3 version of the ASP.NET/AJAX RadControl Suite, is there a built-in way to save / restore the current layout (ie: filtering, sorting, column order, visible columns, etc) of the grid?

ie:  Similar to what DevExpress provides:  http://www.devexpress.com/Help/?document=ASPxGridView/CustomDocument4342.htm&levelup=true

I found a code sample on your help site which seems to provide a sample piece of code for this (http://www.telerik.com/help/aspnet-ajax/grdsavingsettingsonperuserbasis.html) but the code does not compile.  (Haven't really dug into why...)

Thanks,

Roy
DogBizPro
Top achievements
Rank 1
 answered on 31 Jan 2018
2 answers
143 views
Hi, I have a site which uses forms authentication and has a grid with an AJAX manager. When the session expires, I'd like the user to be bounced back to the login page. A page refresh sends me back to the login correctly. However, when interacting with the grid (sorting, filtering, etc) after the session has expired, I get the following error in a popup box:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0

I searched the forum for solutions, but all the posts appear to be a few years old. What is the current solution to this problem? Thanks.


Daniel
Top achievements
Rank 1
 answered on 31 Jan 2018
1 answer
160 views

Hello,

 

I have a page that I'm building that uses a AutoCompleteBox inside of a repeater.  I am trying to load the control inside of the the ItemDataBound method of the repeater, but an error gets thrown before it can even be called saying "Datasource not set" referring to the AutoCompleteBox.  Is there a specific way that I should be loading the control?  Here is a snippet of the control being loaded inside the ItemDataBound method of the repeater.  Thanks for any help.

 

{

     RepeaterItem item = e.item;

 

    txtAgent = (RadAutoCompleteBox)item.FindControl("txtAgent");

    txtAgent.DataSource  = Agent.GetListOfAgents();

    txtAgent.DataBind();

}

Peter Milchev
Telerik team
 answered on 31 Jan 2018
1 answer
269 views

Hi,

 

I'm trying to generate a full report as a single pdf and I'm wondering if it's possible to add for example an existing pdf file between 2 pages of the pdf rendered ?

Should I find a way to render the pdf on a view page using third party js libraries for pdf rendering or is there a way to do this using only this component ?

 

Thanks,

Grégory
Top achievements
Rank 1
 answered on 31 Jan 2018
1 answer
124 views

Would it be possible to use the ClientExportManager to send a chunk of raw data to the server.

Just send the data and skip the PDF and Image conversion part?

 

Thanks,

Marc

Rumen
Telerik team
 answered on 31 Jan 2018
5 answers
525 views
Hello,
I tried to build a small test page that has a autocompletebox bind to a web method in the code behind of the page.
I copied the example from the autocompletedemo page, but I got this error : "The server method 'GetCompanyNames' failed."
There is a snippet of my code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server"></telerik:RadScriptManager>
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">
            <div>
                <fieldset style="width: 400px">
                    <legend>Web service binding</legend>
                    <label for="RadAutoCompleteBox2">
                        Company Names:</label>
                    <telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteBox2" Width="250" DropDownHeight="150"
                        DropDownWidth="250">
                        <WebServiceSettings Path="Defualt.aspx" Method="GetCompanyNames" />
                    </telerik:RadAutoCompleteBox>
                    <p>
                        <asp:Label runat="server" ID="Label2" />
                    </p>
                </fieldset>
            </div>
        </telerik:RadAjaxPanel>
    </form>
</body>
</html>


Code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    [WebMethod]
    public AutoCompleteBoxData GetCompanyNames(object context)
    {
        string searchString = ((Dictionary<string, object>)context)["Text"].ToString();
        List<AutoCompleteBoxItemData> result = new List<AutoCompleteBoxItemData>();
        AutoCompleteBoxItemData childNode = new AutoCompleteBoxItemData();
        childNode.Text = "aaaa";
        childNode.Value = "aaaa";
        result.Add(childNode);
 
        AutoCompleteBoxData res = new AutoCompleteBoxData();
        res.Items = result.ToArray();
 
        return res;
    }
}



Thank you for your help,
Kind regards,
Oren Yardeni.
Peter Milchev
Telerik team
 answered on 31 Jan 2018
1 answer
422 views

Only occasionally I am receiving the "IOException: The process cannot access the file 'file path' because it is being used by another process".

How can I handle my upload to avoid encountering this error?

Here's my code example.

On the webform page.

                            <telerik:RadAsyncUpload
                                runat="server"
                                ID="fileUpload"
                                ChunkSize="3145728"
                                MaxFileInputsCount="1"
                                AllowedFileExtensions=".htm,.html,.HTML,.doc,.DOC,.docx,.zip,.txt,.mht,.MHT,.msg,.mp4,.pdf,.PDF"
                                OnClientValidationFailed="uploadValidationFailed">
                            </telerik:RadAsyncUpload>
                            <telerik:RadProgressArea
                                runat="server"
                                ID="RadProgressAreaTechNotes">
                            </telerik:RadProgressArea>

Codebehind

                    foreach (UploadedFile file in fileUpload.UploadedFiles)
                    {
                        uploadedFilename = file.FileName;
                        asyFileExtension = file.GetExtension().Replace(".", string.Empty);
                        asyFileSize = file.ContentLength;
                        string spath = storePath + uploadedFilename;

                        file.SaveAs(spath);
                    }

 

 

Marin Bratanov
Telerik team
 answered on 30 Jan 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?