Telerik Forums
UI for ASP.NET AJAX Forum
12 answers
1.0K+ views
I'm trying to implement a "classic" solution where filtering, sorting and paging happens at db level and the retrieved resultset is only the one needed. That way it should be lighter to handle bigger database since if you have a page of 50 items you only set those 50 items as datasource.
I would like to keep a tradeoff between this performance boost and the automatic functionalities the grid offers (mostly in the CRUD scendario, of course I'll have to handle all the selects for paged and filtered datasets)
Anyway... I'm trying to accomplish this with NeededDataSource (I was wondering if ObjectDataSource is better for this.. is it?)
I'm finding my way through paging and this is quite straightforward: 

Protected Sub RadGrid1_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs)
    Dim dataSource As New MyUsersManager
    Dim query As New PagedQuery
    Dim result As ResultPage(Of MyUser)
 
    query.ItemsPerPage = RadGrid1.MasterTableView.PageSize
    query.PageNumber = RadGrid1.MasterTableView.CurrentPageIndex + 1
 
    result = dataSource.GetPage(query)
 
    RadGrid1.MasterTableView.VirtualItemCount = result.TotalItems
    RadGrid1.MasterTableView.DataSource = result.Items
End Sub

The problem is that I always get page index 0... even if the pager updates and I'm on page 2 or 3 I always get pagindex 0 in the NeedDataSource events... why?

I wonder how can I factor in the filtering and the sorting... How can I retrieve the filtering parameters and sorting (maybe even multisorting) parameters inside NeedDataSource? Should I create page properties that are updated from filtering and sorting events and then read from NeedDataSource event, or is there a more straightforward way to do it?

What about grouping? Will this work with my custom implementation? I suppose it won't show the summaries for grouped paging anymore (like "you are viewing n records of group x and still more y records on next page" or such) but will it work the same? Or do I have to retrieve the whole 1 milion records dataset to benefit from grouping? Same for footer summaries, will those work on a single page basis or do they only work with the full db?

I think this should be a common scenario for larger implementation for e-commerce sites, or where db grows to a considerable size in general  (like for example in a multiapp SaaS framework wich serves multiple sites from a single app and the DB has data from all the sites)

Thanks in advance
Massimiliano
Top achievements
Rank 1
 answered on 13 Sep 2013
1 answer
117 views
Hello,

I'm attempting to allow my users to select multiple items inside a RadPanelBar.  To accomplish this, I have programmatically added CheckBoxes inside each RadPanelItem.  However, they are appearing on their own line.  Is there a way to align the CheckBoxes to the same line as the text of the RadPanelItem?  I have included an image for reference.

Also, If there is an easier way to display hierarchical data allowing multiple selection, I'm open to the idea of using another control instead.  (Could RadTreeView and/or RadTreeList be options?)

Thank you for your help!

Regards,
Brian Chambers
Brian
Top achievements
Rank 1
 answered on 13 Sep 2013
1 answer
96 views
Hello,
I am using a Rad Editor control on my webpage. I am using custom CSS file to populate the styles classes in "Apply CSS" drop down. The issue i am facing is IE specific. In my CSS file i have some classes defined as

h3,.style1{
font-weight: bold;
font-size: 14px;
color: #000000;
}


This works fine in all browsers except in IE, it displays two classes :-
style1 - this refers to h3,.style1
style1 - this refers to .style1

Please let me know how can i fix this.

Thanks
Sumit
Ianko
Telerik team
 answered on 13 Sep 2013
1 answer
117 views
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Collections;
using Telerik.Web.UI;
using System.IO;
using System.Web.Services;
 
namespace My_Workshop.A4f
{
    public partial class DataSource : System.Web.UI.Page
    {
        public AllClass AllClass = new AllClass(); SqlConnection con = AllClass.dbConnection();
        //获取页码
        public void getcnt()
        {
            AllClass.SearchDef Def = new AllClass.SearchDef();
            Def.AssPat = this.RadAssPat; Def.Business = this.RadBusi; Def.ProSeries = this.RadPro; Def.PtoTyp = this.RadPtoTyp;
            Def.Disposal = this.RadDisposal1; Def.DefMat = this.RadDefMat; Def.STimd = this.TxtSTim.Text; Def.OTimd = this.TxtOTim.Text;
            Def.ProCode = this.RadProCode; Def.Modul = this.RadModul; Def.CusCode = this.RadCusCode; Def.CityOffice = this.RadCityOffice;
            Def.PlantCode = this.RadPlantCode; Def.OilWay = this.RadOilWay.Text; Def.AssPlant = this.RadAssPlant1;
            Def.AssPatCod = this.RadPat; Def.STima = this.TxtSTima.Text; Def.OTima = this.TxtOTima.Text;
            string sc = "select count(*) from tbDef where(1=1) " + AllClass.getwdd(Def);
            ViewState["cnt"] = AllClass.ExecuteScalar(sc, con).ToString();
        }
        //显示
        public void show(int currentpage)
        {
            AllClass.SearchDef Def = new AllClass.SearchDef();
            Def.AssPat = this.RadAssPat; Def.Business = this.RadBusi; Def.ProSeries = this.RadPro; Def.PtoTyp = this.RadPtoTyp;
            Def.Disposal = this.RadDisposal1; Def.DefMat = this.RadDefMat; Def.STimd = this.TxtSTim.Text; Def.OTimd = this.TxtOTim.Text;
            Def.ProCode = this.RadProCode; Def.Modul = this.RadModul; Def.CusCode = this.RadCusCode; Def.CityOffice = this.RadCityOffice;
            Def.PlantCode = this.RadPlantCode; Def.OilWay = this.RadOilWay.Text; Def.AssPlant = this.RadAssPlant1;
            Def.AssPatCod = this.RadPat; Def.STima = this.TxtSTima.Text; Def.OTima = this.TxtOTima.Text;
            int pagesize = this.RadDataPager1.PageSize;
            string sw = AllClass.getwdd(Def);
            string s = "select top " + pagesize +
    "DefID,MendDat,Business,OilSystem,CusNam,AssDat,AssPlant,DefMat,ProSeries,AssPatCod,AssPat,Disposal,Modul,PlantNam from tbDef where DefID not in(select top " + pagesize * (currentpage) +
    " DefID from tbDef where(1=1) " + sw + "order by DefID desc)" + AllClass.getwdd(Def) + "order by DefID desc";
            AllClass.showdata0(s, con, this.RadGrid2);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ((Label)(this.Page.Master.FindControl("LblSitMap"))).Text = "故障明细管理";
                this.TxtOTim.Text = DateTime.Now.ToString("yyyy-MM-dd");
                this.TxtSTim.Text = DateTime.Now.ToString("yyyy-01-01");
                DataTable dtt = new DataTable();
                this.RadGrid2.MasterTableView.NoMasterRecordsText = "欢迎您!";
                this.RadGrid2.DataSource = dtt;
                this.RadGrid2.DataBind();
                dtt.Dispose();
            }
 
 
        }
 
        protected void tb_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
                case "查询":
                    getcnt();
                    show(this.RadDataPager1.CurrentPageIndex);                    
                    break;
                default:
                    break;
            }
        }
        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {              
                e.Item.Attributes.Add("OnDblClick", "window.radopen('DataView/DefDetail.aspx?DefID=" +
                    this.RadGrid2.MasterTableView.DataKeyValues[e.Item.ItemIndex]["DefID"]+ "', 'RadWindow1');");
            }
        }
         
 
        protected void RadDataPager1_TotalRowCountRequest(object sender, RadDataPagerTotalRowCountRequestEventArgs e)
        {
            e.TotalRowCount = Convert.ToInt32(ViewState["cnt"]);
        }
        protected void RadDataPager1_PageIndexChanged(object sender, RadDataPagerPageIndexChangeEventArgs e)
        {
            show(e.NewPageIndex);
        }
 
        string GenerateButtonText(string argument)
        {
            return String.Format("<span>{0}</span>", int.Parse(argument) + 1);
        }
 
        protected void RadDataPager1_FieldCreated(object sender, RadDataPagerFieldCreatedEventArgs e)
        {
            if (e.Item.Field is RadDataPagerButtonField && (e.Item.Field as RadDataPagerButtonField).FieldType == PagerButtonFieldType.Numeric)
                foreach (IButtonControl ctrl in e.Item.Controls)
                    ctrl.Text = GenerateButtonText(ctrl.CommandArgument);
        }
 
    }
}
public void showdata0(string s, SqlConnection con, RadGrid gv)
        {
            DataTable dt = AllClass.dt(s, con);
            gv.DataSource = dt;
            gv.DataBind();
            dt.Dispose();
        }
I got this Exception"RegisterRequiresControlState can only be called before and during PreRender."but asp:gridview works well
Daniel
Telerik team
 answered on 13 Sep 2013
1 answer
109 views
An error is found when calling client side method resetZoom on the Chart control.  Up to version 2013.2.611.45 everything was working fine but since the apply of the release 2013.2.903.45 the function call return an error.

Unhandled exception at line 15, column 16485 in http://localhost:49162/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=radScriptManager_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:en-US:c9cbdec3-c810-4e87-846c-fb25a7c08002:ea597d4b:b25378d2;Telerik.Web.UI,+Version=2013.2.903.45,+Culture=neutral,+PublicKeyToken=121fae78165ba3d4:en-US:57d8db9c-03e9-4d79-85fa-5fff26620928:16e4e7cd:86526ba7:874f8ea2:ed16cbdc:f7645509:24ee1bba:e330518b:2003d0b8:1e771326:c8618e41:f46195d3:aa288e2d:19620875:cda80b3:383e4ce8:a51ee93e:59462f1:7165f74:7918c3fa
 
0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
 
Details: Error parsing near '
 
 
 
<html xmlns="htt'.
Thanks in advance
Stephane
Petar Kirov
Telerik team
 answered on 13 Sep 2013
4 answers
116 views
Hello all.

I want the user to select a master data record (in a RadWindow) and fill most of the grid fields from that selection. At the moment it is solved by having an additional button outside the grid. Technically okay and working. But it is quite ugly and the user won't understand why there are buttons (save and refresh) inside and one outside.

The solution "put all buttons outside the grid" is not the elegant way. So I studied the documentation http://www.telerik.com/help/aspnet-ajax/grid-batch-editing.html

But I found no way to intercept, modify or override the add new record buttons behaviour.

Is there really no elegant way to have a custon insert routine?

Kind regards
Bernd
Bernd
Top achievements
Rank 2
 answered on 13 Sep 2013
2 answers
290 views
ASP .NET AJAX Q3 2012

I have a simple grid with a MasterTableView, some columns at that level, and then a child DetailTable/GridTableView.
I need a modal popup on the child GridTableView. 
I set this on the GridTableView:  EditMode=PopUp and <EditFormSettings EditFormType="AutoGenerated" PopUpSettings-Modal="true"></EditFormSettings>

When I click the edit icon for a row in the GridTableView, the modal popup appears, but the background is NOT greyed-out, and the controls "behind" the popup are available to the user. The popup is NOT modal.

If I instead change things so the MasterTableView has EditMode=PopUp and the EditFormSettings are at the MasterTableView level (just like your demos) the popup opens and displays as it should, modally and with the grey background.

Please validate that this is a bug, how I can get it fixed or if there is a work around or other ways to achieve what I'm trying to do.


Deborah
Top achievements
Rank 1
 answered on 13 Sep 2013
2 answers
109 views

We recently updated our ASP.NET AJAX controls from version 2012.03.1017.0 to 2013.02.717.0. Something that I noticed is that a telerik:GridBoundColumn with Visisble="false" would still bind and be accessible from the code behind with the older control, but no longer binds with the new control. Is this a known change or perhaps an unintended side effect?

By the way, the fix for this in our case was easy- we simply used a datakey instead of a hidden bound column.

Thank you.
Trey
Top achievements
Rank 1
 answered on 13 Sep 2013
3 answers
140 views
In IE10 when I include a LoadingPanel in either RadAjaxPanel or RadAjaxManager, a button click that should produce an AJAX callback, does nothing. If I switch to compatibility view, then the button click works properly. (I saw the sticky, but it seems to be directed at older browsers.)

Below is a simplified page that demonstrated the problem using both a LoadingPanel and RadAjaxPanel .

<asp:ScriptManager ID="ScriptManager1" runat="server" EnableTheming="True"></asp:ScriptManager>

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

   
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" style="margin:40px;" LoadingPanelID="RadAjaxLoadingPanel1" >

    RadAjaxPanel test:

    <asp:Button id="Button1" runat="server" text="Test 1" onclick="Button1_click" />

    <br /> <br /> <asp:Label ID="timestamp1" runat="server"></asp:Label>

</telerik:RadAjaxPanel>

 

   
<
telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" RestoreOriginalRenderDelegate="false">

   <AjaxSettings>

     <telerik:AjaxSetting AjaxControlID="Button2">

       <UpdatedControls>

         <telerik:AjaxUpdatedControl ControlID="AjaxPanel" LoadingPanelID="RadAjaxLoadingPanel1" />

       </UpdatedControls>

     </telerik:AjaxSetting>

   </AjaxSettings>

</telerik:RadAjaxManager>

<asp:panel ID="AjaxPanel" runat="server" style="margin:40px;">

     RadAjaxManager test:

     <asp:Button id="Button2" runat="server" text="Test 2" onclick="Button2_click" />

     <br /><br />

     <asp:Label ID="timestamp2" runat="server"></asp:Label>

</asp:panel>

 

And here's the codebehind for the buttons:

Sub Button1_click(ByVal sender As Object, ByVal e As System.EventArgs)

   timestamp1.Text += "<br>" & Now

End Sub

Sub Button2_click(ByVal sender As Object, ByVal e As System.EventArgs)

   timestamp2.Text += "<br>" & Now

End Sub

This page works in Chrome, FF, older versions of IE, and IE10 compatibility view, but not in plain IE10. As soon as I remove the LoadingPanel, then it also works in plain IE10.

I assume I've overlooked something simple. But I can't find it. Any help would be appreciated!

Cheri
 

 

 

 

 

Deyan Enchev
Telerik team
 answered on 13 Sep 2013
2 answers
336 views
I am using Chart to create a small sparkline chart in a grid column.  Works great but I can't figure out how to get a truly transparent background on the chart.  I am setting colors thusly:

chart.PlotArea.Appearance.FillStyle.MainColor =

Color.Transparent;

 

chart.PlotArea.Appearance.FillStyle.SecondColor =

Color.Transparent;

 


But when the chart is displayed on an alternating color row the background of the chart is white, not transparent.
Venelin
Telerik team
 answered on 13 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?