This is a migrated thread and some comments may be shown as answers.

Paging is not working if I rebind the grid.

18 Answers 698 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 29 Oct 2011, 09:54 AM
Hi
I'm using radrgid in my application inside the radpanelbar as one of the radpanelitem.
I need to get the data from database on regular interval of 2 minutes and need to show in grid without need of refreshing the page.
For the I'm using Timer and updating the panelbar using asp:updatepanel with conditional updatemode and calling needdatasource event from pageload for every 2 minutes.
So to have the chages on interval basis I'm rebing the grid.
But paging is not working. If I dnt rebind the grid I'm not able to see the new chages.
 here is my code of needdatasource event
DataTable dtConsole = new DataTable();
       DataAccess accessData = new DataAccess();
       try
       {
           dtConsole = accessData.GetData("select consolename from CONSOLE");
           consloeGrid.DataSource = dtConsole;
           //if I dont rebind new data not showing else paging is not working
           consloeGrid.Rebind();
           if (dtConsole.Rows.Count > 10)
           {
               consloeGrid.AllowPaging = true;
           }
       }
Please help me as early as possible.

18 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 29 Oct 2011, 10:18 AM
Hello Ram,

When are binding the grid with NeedDataSource event, there is no need to explicitly call Rebind() after each operation. The event fires each time after paging, grouping, sorting etc.

Thanks,
Shinu.
0
Ram
Top achievements
Rank 1
answered on 29 Oct 2011, 10:48 AM
Thanks for ur quick reply.
But if don't rebind the grid I'm not able to see the new entry that just added.
In the table that which I binding to grid has the new entry but in grid its not showing.
I'm calling the needdatasource event for every 2 or 3 minutes.
After doing paging only I'm able to see new entry else its not showing
what should I do.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 29 Oct 2011, 10:58 AM
Hello,

you can use Advanced Data Binding for automatically handling the paging or handle manually paging.

Note : for manually binding
OnPageIndexChanged()
{
e.canceld = true;
dtConsole = accessData.GetData("select consolename from CONSOLE");
consloeGrid.MasterTableView.CurrentPageIndex =0 ; // new page index
           consloeGrid.DataSource = dtConsole;consloeGrid.DataBind();
}

But i suggest you to use advance data binding.

You can store your data in viewstate/session/cache and achieve your requirement.
for ex.
try
       {
           dtConsole = accessData.GetData("select consolename from CONSOLE");
           session["dtConsole"]= dtConsole;
           //if I dont rebind new data not showing else paging is not working
          
           if (dtConsole.Rows.Count > 10)
           {
               consloeGrid.AllowPaging = true;
           }
           consloeGrid.Rebind();
       }
........
needDataSource()
{
consloeGrid.DataSource =session["dtConsole"] as DataTable;
}




Thanks,
Jayesh Goyani
0
Ram
Top achievements
Rank 1
answered on 29 Oct 2011, 11:39 AM
Hii thanks for ur answer.
Still its not working.
I don't that  whether I was able to express my problem or not.
My requirement is.

First time when page load I will bind table to grid like in needdatasource.
consolegrid.datasource=dtconsole;
after 2 or 3 minutes(not refreshing wholepage) I'm calling needdatasource event to bind data and this time datatable having entry if any new data has inserted but for grid its not binding I think.
But If I call console.rebind() immedialtly after  consolegrid.datasource=dtconsole then its showing new record.
This time if I do paging its not moving to first page to second means paging not working.
If I dont call rebind its working.
0
Ram
Top achievements
Rank 1
answered on 31 Oct 2011, 05:20 AM
Hi shinu here is my code

protected

 

 

void Page_load(object sender, EventArgs e)

 

{

 

 

//set the timer interval

 

refreshTimer.Interval = 10 * 60 *50;

 

 

if (Page.IsPostBack)

 

{

 

 

GridNeedDataSourceEventArgs GDE = null;

 

consloeGrid_NeedDataSource(

 

null, GDE);

 

}

 

}

 

 

 

protected void refreshTimer_Tick1(object sender, EventArgs e)

 

{

}


protected

 

 

void consloeGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)

 

{

 

 

DataTable dtConsole=bindGrids("select consolename from CONSOLE");

 

consloeGrid.DataSource = dtConsole;

 

if (dtConsole.Rows.Count > 10)

 

{

consloeGrid.AllowPaging =

 

true;

 

}

 

 

else

 

{

consloeGrid.AllowPaging =

 

false;

 

}
//Here if I rebind() I'm able to see new records. but If rebind the grid paging is not working.Even though I handled pageindexchaged event, its not calling. If I dont rebind paging is working and new records showing only after do paging.
consoleGrid.Rebind();

}
Pleas help me as early as possible since its urgent for me.

0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 31 Oct 2011, 07:43 AM
Hello,


set below property in radgrid.

<telerik:RadGrid  AllowPaging="true" PageSize="10">
          <PagerStyle AlwaysVisible="false" />


CHeck below link for automatically refresh your grid .
http://demos.telerik.com/aspnet-ajax/ajax/examples/common/ajaxifytimer/defaultcs.aspx

Thanks,
Jayesh Goyani
0
Shinu
Top achievements
Rank 2
answered on 31 Oct 2011, 07:47 AM
Hello Ram,

If you are using Advanced data binding, the grid will rebind each time after any operation. If you are using timer for rebinding the grid, call Rebind() method in the timer tick event. Check the following demo for more on this.
Ajax / Ajaxify Timer.

Thanks,
Shinu.
0
Ram
Top achievements
Rank 1
answered on 31 Oct 2011, 09:25 AM
Thanks very much.
It did trik.
0
Duy
Top achievements
Rank 1
answered on 12 Jun 2013, 04:51 PM
i was able to get this to work for pageindexchanged. but i can't do this for pagesizechanged, it put me into an infinite loop and then crash with "Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space." error. any idea how to resolve the pagesizechanged Jayesh? thank you for your help.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 15 Jun 2013, 03:23 PM
Hello,

If possible then can you please provide your code?

Thanks,
Jayesh Goyani
0
Duy
Top achievements
Rank 1
answered on 17 Jun 2013, 01:09 PM
<telerik:RadPanelBar ID="RadPanelBar1" ExpandMode="MultipleExpandedItems" Width="100%"
    runat="server">
    <Items>
        <telerik:RadPanelItem Expanded="true" Text="Step1" runat="server" Selected="true">
            <Items>
                <telerik:RadPanelItem Value="New" runat="server">
                    <ItemTemplate>
                        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" PageSize="10" OnPageIndexChanged="RadGrid1_PageIndexChanged">
                            <MasterTableView AutoGenerateColumns="false" HeaderStyle-HorizontalAlign="Center"
                                DataSourceID="SqlDataSource2" ItemStyle-HorizontalAlign="Center" AlternatingItemStyle-HorizontalAlign="Center">
                                <Columns>
                                    <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID" UniqueName="OrderID"
                                        ReadOnly="true" />
                                    <telerik:GridBoundColumn DataField="OrderDate" HeaderText="OrderDate" UniqueName="OrderDate"
                                        DataFormatString="{0:MM/dd/yyyy}" />
                                </Columns>
                            </MasterTableView>
                            <PagerStyle Mode="NextPrevAndNumeric" />
                        </telerik:RadGrid>
                        <asp:Button ID="btn" runat="server" Text="Get Data" OnClick="btn_Click" />
                    </ItemTemplate>
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelItem>
    </Items>
</telerik:RadPanelBar>
Protected Sub RadGrid1_PageSizeChanged(source As Object, e As GridPageSizeChangedEventArgs)
    RadGrid1.CurrentPageIndex = e.NewPageSize
    RadGrid1.DataBind()
End Sub
Thank you Yayesh
0
Eyup
Telerik team
answered on 20 Jun 2013, 08:25 AM
Hi Duy,

Please note that using DataBind() is not recommended. Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
Declarative DataSource
Advanced Data Binding

Hope this helps.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 20 Jun 2013, 09:33 AM
Hello,

RadGrid will manage all things automatically we do not need manage it manually for Declarative DataSource and Advance Data Binding.

Please check below link.
Commands that invoke Rebind() implicitly

Thanks,
Jayesh Goyani
0
John
Top achievements
Rank 1
answered on 02 Sep 2015, 06:28 PM

Why does Telerik have "Simple Data Binding", if it is apparently such a problem?  Quite often, on many of the forum threads, it is recommended to use Advanced.  They also recommended Adv. DB when getting the Insufficient Stack errors below.  It happens when the user does multiple (4 or more) filter and sort operations on RadGrid.  I switched to OnNeedDataSource, which then points to my BLL, then DAL; but, still no good about 80% of the time.  It will intermittently behave about 20% of the time, whether I use NeedData... or Declarative.  

 

Some of the forum blogs point to RadScriptManager, as the culprit.  In my Master Page, I have ...

<telerik:RadScriptManager runat="server" EnableCdn="true" ID="RadScriptManager1" EnablePageMethods="true" />​

 With EnableCdn="true", I get the first error below.  When I set EnableCdn="false", I get the second error message below.  I also set both to false and got the second error message as well.

 

Another forum blog suggested to view the Call Stack, so I put Breaks in the RadGrid ItemCommand, if (e.CommandName == "Filter" || e.CommandName == "Sort").  The VS Call Stack listed about 20 items.  Stepping beyond the ItemCommand event, it leaves my code and crashes, with an Unhandled exception somewhere in the Telerik assemblies.  How anyone is supposed to diagnose ​an error inside a Telerik dll ... I don't know.  Anyway, it looks like Telerik ASP.Net Ajax is having difficulty with Garbage Collection.  I use version Q3 2014, but, it seems to be happening across multiple versions, because there are many posts about the same thing.  And, to be fair, this might not be a Telerik issue.  It might just be the underlying, less than perfect platform: A​SP.Net/AJAX.

 

Any help will be appreciated.

-john-

 

 

Error #1 ...

Unhandled exception at line 881, column 13 in http://ajax.aspnetcdn.com/ajax/4.5.1/1/MicrosoftAjaxWebForms.debug.js

0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.




Error #2 ...

Unhandled exception at line 15, column 16485 in http://localhost:49721/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:en-US:88fd0407-24cf-4abd-9df5-22f81b2bc835:ea597d4b:b25378d2;Telerik.Web.UI,+Version=2014.3.1209.45,+Culture=neutral,+PublicKeyToken=121fae78165ba3d4:en-US:cd668efa-682a-4e93-b784-26f0724f247c:16e4e7cd:86526ba7:f7645509:24ee1bba:c128760b:19620875:874f8ea2:f46195d3:92fe8ea0:fa31b949:490a9d4e:bd8f85e4:11a04f7e:1e771326:88144a7a:4cacbc31:2a8622d7:e330518b:2003d0b8:c8618e41:1a73651d:333f8d94:ed16cbdc:8e6f0d33:6a6d718d:58366029:aa288e2d:258f1c72:e4f8f289

0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.​

 


0
Konstantin Dikov
Telerik team
answered on 03 Sep 2015, 10:46 AM
Hello John,

Please refer to the answer in the support ticket that you have opened for the same issue: Ticked ID: 967217.

If any further questions arise, I would like to suggest that we continue our conversation in the support ticket.


Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
John
Top achievements
Rank 1
answered on 11 Sep 2015, 05:43 PM

This turned out to be some bad code, on my part.  I was recursively calling FindControl of an inner-container that was not uniquely named.

In a support ticket, Konstantin suggested:
1) "...the error that you are receiving could be due to a infinite loop or endless recursion in your code-behind..."
2) "...disable the AJAX on your page (by setting the EnableAJAX property of your RadAjaxManager/RadAjaxPanelto false) and see the full stack trace of the error."

... which lead me to the resolution.  

Upon disabling Ajax, I re-tested and caused it to crash with the Insufficient Stack error.  The Stack Trace had 2400+ calls, indicating an infinite loop, mostly of RenderControl event.  Upon some minor Googling, that lead me to FindControl , which lead me to ItemCreate.  My ItemCreate was shared by all (3) RadGrids on (3) tabs, in the same page.  All (3) RadGrids have a NestedViewTemplate, with the same ID="InnerContainer".    I then made the ID unique for each (ie. InnerContainer
_RadGrid1). 

 

Thanks, Konstantin!

0
dahan
Top achievements
Rank 1
Veteran
answered on 15 Jun 2020, 11:10 AM

Hi,

I am using the textbox, RadNumericTextBox and RadAutoCompleteBox inside the grid to receive the values and store them in the DB. However, when a lot of data needs to be input, the speed of binding becomes slower, so virtualization and paging are performed. So, there is a problem of turning the loop to get the data of the grid and not getting the entire data.
RadGridItems.AllowPaging = false; RadGridItems.Rebind(); I need to get the data entered in needdatasource at the time, but I don't know how to get it. Please tell me how to get all the data entered on the paged grid. Please help me its urgent issue.please refer code below.
<telerik:RadGrid ID="RadGridItems" runat="server" AllowMultiRowSelection="true" ShowFooter="true" RenderMode="Lightweight" 
                OnItemDataBound="RadGridItems_ItemDataBound" OnRowDrop="RadGridItems_RowDrop" AutoGenerateColumns="false" AllowAutomaticDeletes="true" 
                 OnPageIndexChanged="RadGridItems_PageIndexChanged" 
                ShowStatusBar="false" EnableEmbeddedSkins="true" EnableEmbeddedBaseStylesheet="true" CssClass="brd_list2" PagerStyle-CssClass="brd_pager2" Width="1920">
<MasterTableView EnableHeaderContextMenu="false" NoMasterRecordsText="" HeaderStyle-Wrap="false" ItemStyle-Wrap="false" AlternatingItemStyle-Wrap="false">
                    <ColumnGroups>
                        <telerik:GridColumnGroup HeaderText="예상매입처" Name="Buy"></telerik:GridColumnGroup>
                        <telerik:GridColumnGroup HeaderText="예상운반비" Name="Trans"></telerik:GridColumnGroup>
    </ColumnGroups>
<Columns>
<telerik:GridClientSelectColumn UniqueName="chkline" HeaderStyle-Width="30" ItemStyle-CssClass="col_ct"></telerik:GridClientSelectColumn>
                        <telerik:GridBoundColumn DataField="Sequence" HeaderText="번호" Visible="false" HeaderStyle-Width="40px" ItemStyle-CssClass="col_ct"></telerik:GridBoundColumn>

                        <telerik:GridTemplateColumn HeaderText="품목코드" HeaderStyle-Width="100" ItemStyle-CssClass="col_ct" >
<ItemTemplate>
                                <telerik:RadTextBox ID="ItemCode" runat="server" Enabled="false" Text='<%# DataBinder.Eval(Container.DataItem, "ItemCode")%>' Skin="Windows7"></telerik:RadTextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
    <telerik:GridBoundColumn DataField="ItemName" UniqueName="ItemName" Display="false" HeaderText="품목명"></telerik:GridBoundColumn> 
                                                      
<telerik:GridTemplateColumn HeaderText="수종" HeaderStyle-Width="140">
<ItemTemplate>
<telerik:RadAutoCompleteBox ID="TreeCode" runat="server" OnClientTextChanged="TreeCode_TextChanged" DropDownPosition="Automatic" DropDownWidth="250" DataSourceID="TreeSpecies" 
                                    DataValueField="ItemCode" DataTextField="TreeName" InputType="Text" Skin="Windows7" OnDataSourceSelect="TreeCode_DataSourceSelect">
<DropDownItemTemplate>
<table>
<tr>                                                 
<th><%# DataBinder.Eval(Container.DataItem, "TreeName")%></th>                                                                                               
                                                <th>,&nbsp;</th>
                                                <th><%# DataBinder.Eval(Container.DataItem, "Description")%></th>
</tr>
</table>
</DropDownItemTemplate>
<TextSettings SelectionMode="Single" />                                  
</telerik:RadAutoCompleteBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
                     
                        <telerik:GridTemplateColumn HeaderText="규격" HeaderStyle-Width="120" ItemStyle-CssClass="col_ct">
<ItemTemplate>
<telerik:RadTextBox ID="Description" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Description")%>' Width="130" Skin="Windows7"></telerik:RadTextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>                                                         

<telerik:GridTemplateColumn UniqueName="Quantity" HeaderText="수량" HeaderStyle-Width="80" ItemStyle-CssClass="col_rg" FooterStyle-CssClass="col_rg">
<ItemTemplate>
<telerik:RadNumericTextBox ID="Quantity" EmptyMessage="0" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="64px" Enabled="true"
DbValue='<%# Bind("Quantity") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Width="115px" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
                                    <ClientEvents OnValueChanged="CalculateSupplyAmount" />
</telerik:RadNumericTextBox>
</ItemTemplate>
                            <FooterTemplate>
<telerik:RadNumericTextBox ID="SumQuantity" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" Width="100px" Height="19px" LabelWidth="64px"
DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</FooterTemplate>
</telerik:GridTemplateColumn>                                                                     
                        <telerik:GridTemplateColumn UniqueName="UnitPrice" HeaderText="매출단가" HeaderStyle-Width="6%" ItemStyle-CssClass="col_rg align_txt_src" FooterStyle-CssClass="col_rg">
<ItemTemplate>
                               
                                <telerik:RadNumericTextBox ID="UnitPrice" EmptyMessage="0" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="24px" Enabled="true"
    DbValue='<%# Bind("UnitPrice") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
    <NegativeStyle Resize="None"></NegativeStyle>
    <NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
    <EmptyMessageStyle Resize="None"></EmptyMessageStyle>
    <ReadOnlyStyle Resize="None"></ReadOnlyStyle>
    <FocusedStyle Resize="None"></FocusedStyle>
    <DisabledStyle Resize="None"></DisabledStyle>
    <InvalidStyle Resize="None"></InvalidStyle>
    <HoveredStyle Resize="None"></HoveredStyle>
    <EnabledStyle Resize="None"></EnabledStyle>
                                    <ClientEvents OnValueChanged="CalculateSupplyAmount" />
    </telerik:RadNumericTextBox> 
                                <telerik:RadButton ID="btnUnitPrice" AutoPostBack="true" OnClick="btnUnitPrice_Click" runat="server" Text="Search" Skin="" CssClass="btn_src"></telerik:RadButton>
                                                                                                                                                  
    </ItemTemplate>
</telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn UniqueName="UnitPriceButton" Display="false" HeaderStyle-Width="50">
<ItemTemplate>
                                <span class="telerik_bx inp_btn">
                                    <telerik:RadButton ID="btnUnitPrice2" AutoPostBack="true" OnClick="btnUnitPrice_Click" runat="server" Text="Search" Skin="" CssClass="btn_src"></telerik:RadButton>
                                </span>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

<telerik:GridTemplateColumn UniqueName="SupplyAmount" HeaderText="매출액" HeaderStyle-Width="110" ItemStyle-CssClass="col_rg" FooterStyle-CssClass="col_rg">
<ItemTemplate>
<telerik:RadNumericTextBox ID="SupplyAmount" EmptyMessage="0" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="64px" 
DbValue='<%# Bind("SupplyAmount") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Width="115px" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</ItemTemplate>
<FooterTemplate>
<telerik:RadNumericTextBox ID="SumSupplyAmount" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" Width="120" Height="19px" LabelWidth="64px"
DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</FooterTemplate>
</telerik:GridTemplateColumn>
                       
                        <telerik:GridTemplateColumn HeaderText="코드" ColumnGroupName="Buy" HeaderStyle-Width="60px" ItemStyle-CssClass="col_ct" >
<ItemTemplate>
                                <telerik:RadTextBox ID="VendorCode" runat="server" ClientEvents-OnValueChanged="VendorCode_TextChanged" Text='<%# DataBinder.Eval(Container.DataItem, "VendorCode")%>' Skin="Windows7"></telerik:RadTextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
                        
<telerik:GridTemplateColumn HeaderText="명칭" ColumnGroupName="Buy"  HeaderStyle-Width="190px" ItemStyle-CssClass="col_lf" >
<ItemTemplate>
<telerik:RadAutoCompleteBox ID="VendorName" runat="server" OnClientTextChanged="VendorName_TextChanged" DataSourceID="Vendor" DataTextField="VendorName" DataValueField="VendorCode" InputType="Text" Skin="Windows7" OnDataSourceSelect="VendorName_DataSourceSelect">
<DropDownItemTemplate>
<table>
<tr>
<th><%# DataBinder.Eval(Container.DataItem, "VendorCode")%></th>
<th><%# DataBinder.Eval(Container.DataItem, "VendorName")%></th>
</tr>
</table>
</DropDownItemTemplate>
<TextSettings SelectionMode="Single" />
</telerik:RadAutoCompleteBox>
</ItemTemplate>
</telerik:GridTemplateColumn>                   
                        <telerik:GridBoundColumn DataField="VendorCode" UniqueName="DisVendorCode" Display="false"></telerik:GridBoundColumn>
                        
                        <telerik:GridTemplateColumn HeaderText="매입단가" HeaderStyle-Width="6%" ItemStyle-CssClass="col_rg align_txt_src" FooterStyle-CssClass="col_rg">
<ItemTemplate>       
                                                   
    <telerik:RadNumericTextBox ID="UnitCost2" EmptyMessage="0" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="64px" Enabled="true"
    DbValue='<%# Bind("UnitCost") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
    <NegativeStyle Resize="None"></NegativeStyle>
    <NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
    <EmptyMessageStyle Resize="None"></EmptyMessageStyle>
    <ReadOnlyStyle Resize="None"></ReadOnlyStyle>
    <FocusedStyle Resize="None"></FocusedStyle>
    <DisabledStyle Resize="None"></DisabledStyle>
    <InvalidStyle Resize="None"></InvalidStyle>
    <HoveredStyle Resize="None"></HoveredStyle>
    <EnabledStyle Resize="None"></EnabledStyle>
                                    <ClientEvents OnValueChanged="CalculateCost" />
    </telerik:RadNumericTextBox>
                                
                                <telerik:RadButton ID="btnUnitCost" AutoPostBack="true" OnClick="btnUnitCost_Click" runat="server" Text="Search" Skin="" CssClass="btn_src"></telerik:RadButton>
                                                        
    </ItemTemplate>
</telerik:GridTemplateColumn>
                     
<telerik:GridTemplateColumn HeaderText="매입액" HeaderStyle-Width="110" ItemStyle-CssClass="col_rg" FooterStyle-CssClass="col_rg">
<ItemTemplate>
<telerik:RadNumericTextBox ID="CostAmount" EmptyMessage="0" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="64px" Enabled="true"
DbValue='<%# Bind("Cost") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Width="115px" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</ItemTemplate>
<FooterTemplate>
<telerik:RadNumericTextBox ID="SumCost" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" Width="120" Height="19px" LabelWidth="64px" Enabled="true"
DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</FooterTemplate>
</telerik:GridTemplateColumn>

                        <telerik:GridBoundColumn DataField="FromLocationCode" UniqueName="DisFromLocationCode" Display="false"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ToLocationCode" UniqueName="DisToLocationCode" Display="false"></telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="출도착" ColumnGroupName="Trans" HeaderStyle-Width="270" ItemStyle-CssClass="col_ct align_txt_src">
<ItemTemplate>
                                <telerik:RadAutoCompleteBox ID="FromLocation" runat="server" DataSourceID="FromLocationCode" DataTextField="FromLocationName" DataValueField="FromLocationCode" InputType="Text" Skin="Windows7" OnDataSourceSelect="FromLocation_DataSourceSelect">
<DropDownItemTemplate>
<table>
<tr>
<th><%# DataBinder.Eval(Container.DataItem, "FromLocationCode")%></th>
<th><%# DataBinder.Eval(Container.DataItem, "FromLocationName")%></th>
</tr>
</table>
</DropDownItemTemplate>
<TextSettings SelectionMode="Single" />
</telerik:RadAutoCompleteBox>
                                <telerik:RadAutoCompleteBox ID="ToLocation" runat="server" DataSourceID="ToLocationCode" DataTextField="ToLocationName" DataValueField="ToLocationCode" InputType="Text" Skin="Windows7" OnDataSourceSelect="ToLocation_DataSourceSelect">
<DropDownItemTemplate>
<table>
<tr>
<th><%# DataBinder.Eval(Container.DataItem, "ToLocationCode")%></th>
<th><%# DataBinder.Eval(Container.DataItem, "ToLocationName")%></th>
</tr>
</table>
</DropDownItemTemplate>
<TextSettings SelectionMode="Single" />
</telerik:RadAutoCompleteBox>
                                
                                <telerik:RadButton ID="btnTransPort" AutoPostBack="true" OnClick="btnTransPort_Click" runat="server" Text="Search" Skin="" CssClass="btn_src"></telerik:RadButton>
                                                 
</ItemTemplate>       
</telerik:GridTemplateColumn>
                       
                        <telerik:GridTemplateColumn HeaderText="금액" ColumnGroupName="Trans" HeaderStyle-Width="90" ItemStyle-CssClass="col_rg" FooterStyle-CssClass="col_rg">
<ItemTemplate>
<telerik:RadNumericTextBox ID="DeliveryCost" Runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" DbValueFactor="1" LabelWidth="64px" 
DbValue='<%# Bind("DeliveryCost") %>' MaxValue="7.0368744177664E+15" MinValue="-7.0368744177664E+15" Width="120px" Height="19px" DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="NotSet" FocusedStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
                                    <ClientEvents OnValueChanged="CalculateSumDeliveryCost" />
</telerik:RadNumericTextBox>
</ItemTemplate>
<FooterTemplate>
<telerik:RadNumericTextBox ID="SumDeliveryCost" runat="server" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false" Culture="ko-KR" Width="80" Height="19px" LabelWidth="64px"
DisabledStyle-HorizontalAlign="Right" EmptyMessageStyle-HorizontalAlign="Right" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" HoveredStyle-HorizontalAlign="Right" InvalidStyle-HorizontalAlign="Right" NegativeStyle-HorizontalAlign="Right" ReadOnlyStyle-HorizontalAlign="Right">
<NegativeStyle Resize="None"></NegativeStyle>
<NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
<EmptyMessageStyle Resize="None"></EmptyMessageStyle>
<ReadOnlyStyle Resize="None"></ReadOnlyStyle>
<FocusedStyle Resize="None"></FocusedStyle>
<DisabledStyle Resize="None"></DisabledStyle>
<InvalidStyle Resize="None"></InvalidStyle>
<HoveredStyle Resize="None"></HoveredStyle>
<EnabledStyle Resize="None"></EnabledStyle>
</telerik:RadNumericTextBox>
</FooterTemplate>
</telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="인도조건" ColumnGroupName="Trans" Visible="false" HeaderStyle-Width="80" ItemStyle-CssClass="col_ct">
<ItemTemplate>
<telerik:RadComboBox ID="TermsCode" runat="server" Skin="" Width="100%" DataSourceID="TermsOfDelivery"  
                                     SelectedValue='<%# DataBinder.Eval(Container.DataItem, "TermsCode") %>' DataTextField="TermsName" DataValueField="TermsCode"></telerik:RadComboBox>
</ItemTemplate>       
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="비고" HeaderStyle-Width="130" ItemStyle-CssClass="col_ct">
<ItemTemplate>
<telerik:RadTextBox ID="Memo1" AutoCompleteType="BusinessCity" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Memo1")%>' Width="150" Skin="Windows7"></telerik:RadTextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>                            
</Columns>
</MasterTableView>
<ClientSettings AllowRowsDragDrop="true" EnablePostBackOnRowClick="false">
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" ScrollHeight="350px" />
<Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>
                    <Virtualization EnableVirtualization="true" RetrievedItemsPerRequest="20" InitiallyCachedItemsCount="20" ItemsPerView="20"
                    LoadingPanelID="RadAjaxLoadingPanel1"  EnableCurrentPageScrollOnly="false"/>
</ClientSettings>
</telerik:RadGrid>

RadGridItems.AllowPaging = false;
        RadGridItems.Rebind();
    
        foreach (GridDataItem dataItem in RadGridItems.Items)
        {
            DataRow workRow = dtable.NewRow();

            if (!string.IsNullOrEmpty((dataItem.FindControl("TreeCode") as RadAutoCompleteBox).Text)) 
            {
                workRow["Sequence"] = dataItem.ItemIndex;

                string treeName = (dataItem.FindControl("TreeCode") as RadAutoCompleteBox).Entries[0].Text.Trim();
                string itemCode = (dataItem.FindControl("ItemCode") as RadTextBox).Text.Trim();

                if (!string.IsNullOrEmpty(itemCode))
                {
                    workRow["ItemCode"] = itemCode;
                    workRow["TreeCode"] = utility.getTreeCodeByItemCode(itemCode);
                }
                else
                {
                    workRow["ItemCode"] = string.Empty;
                    workRow["TreeCode"] = string.Empty;
                }

                workRow["TreeName"] = treeName;
                workRow["ItemName"] = treeName;
                               
                workRow["Description"] = (dataItem.FindControl("Description") as RadTextBox).Text;
                workRow["Quantity"] = entry.ConvertStringToDecimal((dataItem.FindControl("Quantity") as RadNumericTextBox).Text.ToString());
                workRow["UnitPrice"] = entry.ConvertStringToDecimal((dataItem.FindControl("UnitPrice") as RadNumericTextBox).Text.ToString());
                workRow["SupplyAmount"] = entry.ConvertStringToDecimal((dataItem.FindControl("SupplyAmount") as RadNumericTextBox).Text.ToString());

                if (!string.IsNullOrEmpty((dataItem.FindControl("VendorName") as RadAutoCompleteBox).Text))
                {
                    workRow["VendorCode"] = (dataItem.FindControl("VendorName") as RadAutoCompleteBox).Entries[0].Value;
                    workRow["VendorName"] = (dataItem.FindControl("VendorName") as RadAutoCompleteBox).Entries[0].Text;
                }
                else
                {
                    workRow["VendorCode"] = string.Empty;
                    workRow["VendorName"] = string.Empty;
                }

                workRow["UnitCost"] = entry.ConvertStringToDecimal((dataItem.FindControl("UnitCost2") as RadNumericTextBox).Text.ToString());
                workRow["Cost"] = entry.ConvertStringToDecimal((dataItem.FindControl("CostAmount") as RadNumericTextBox).Text.ToString());

                if (!string.IsNullOrEmpty((dataItem.FindControl("FromLocation") as RadAutoCompleteBox).Text))
                {
                    workRow["FromLocationCode"] = (dataItem.FindControl("FromLocation") as RadAutoCompleteBox).Entries[0].Value;
                    workRow["FromLocationName"] = (dataItem.FindControl("FromLocation") as RadAutoCompleteBox).Entries[0].Text;
                }
                else
                {
                    workRow["FromLocationCode"] = string.Empty;
                    workRow["FromLocationName"] = string.Empty;    
                }
                if (!string.IsNullOrEmpty((dataItem.FindControl("ToLocation") as RadAutoCompleteBox).Text))
                {
                    workRow["ToLocationCode"] = (dataItem.FindControl("ToLocation") as RadAutoCompleteBox).Entries[0].Value;
                    workRow["ToLocationName"] = (dataItem.FindControl("ToLocation") as RadAutoCompleteBox).Entries[0].Text;
                }
                else
                {
                    workRow["ToLocationCode"] = string.Empty;
                    workRow["ToLocationName"] = string.Empty;    
                }

                workRow["DeliveryCost"] = entry.ConvertStringToDecimal((dataItem.FindControl("DeliveryCost") as RadNumericTextBox).Text.ToString());
                workRow["TermsCode"] = (dataItem.FindControl("TermsCode") as RadComboBox).SelectedValue;
                workRow["Memo1"] = (dataItem.FindControl("Memo1") as RadTextBox).Text;

                dtable.Rows.Add(workRow);
                dtable.AcceptChanges();
            }
        }

protected void RadGridItems_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        //RadGridItems.DataSource = (DataTable)Session["Proposal_DT"];
        //RadGridItems.CurrentPageIndex = RadGridItems.MasterTableView.CurrentPageIndex;
    }



0
Eyup
Telerik team
answered on 18 Jun 2020, 05:27 AM

Hi Dahan,

 

I am afraid Virtualization is not suitable for editing:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/functionality/scrolling/virtualization#internal-logic-and-use-cases 

 

Regards,
Eyup
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Ram
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ram
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Duy
Top achievements
Rank 1
Eyup
Telerik team
John
Top achievements
Rank 1
Konstantin Dikov
Telerik team
dahan
Top achievements
Rank 1
Veteran
Share this question
or