Hi,
Below I have given code of user control which I used multiple times on single page.But my problem is that I got null values in HandleScrolling() function when I moved grid scroll down to bottom.
I have placed Radscriptmanager on main .aspx page.
And one more important thing is I have made this user control's DLL and used in other project by adding reference of that usercontrol's dll.
<%@ Control Language="C#" ClassName="Acme.MyTestUC" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace=" System.Reflection" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
manager1 = RadAjaxManager.GetCurrent(this.Page);
manager1.AjaxSettings.AddAjaxSetting(manager1, RadGrid2);
manager1.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager1_AjaxRequest);
}
void manager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
RadGrid2.PageSize += 15;
RadGrid2.Rebind();
}
RadAjaxManager manager1;
</script>
<!-- content start -->
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
<!--
function HandleScrolling(e) {
var grid = $find("<%=RadGrid2.ClientID %>");
//alert(grid.hasOwnProperty());
var scrollArea = document.getElementById("<%= RadGrid2.ClientID %>" + "_GridData");
if (IsScrolledToBottom(scrollArea)) {
var currentlyDisplayedRecords = grid.get_masterTableView().get_pageSize() * (grid.get_masterTableView().get_currentPageIndex() + 1);
//if the presently visible items are less than the entire source records count
//trigger an ajax request to increase them
if (currentlyDisplayedRecords < 100) {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("LoadMoreRecords");
}
}
}
//this method calculates whether you have reached the bottom when dragging the vertical grid scroll
function IsScrolledToBottom(scrollArea) {
var currentPosition = scrollArea.scrollTop + scrollArea.clientHeight;
return currentPosition == scrollArea.scrollHeight;
}
-->
</script>
</telerik:RadCodeBlock>
<telerik:RadAjaxManagerProxy id="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel2"></telerik:AjaxUpdatedControl>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy >
<telerik:RadGrid ID="RadGrid2" AllowSorting="True"
runat="server" AllowPaging="true" Width="97%" PageSize="15" GridLines="Vertical">
<PagerStyle Visible="false" />
<MasterTableView TableLayout="Fixed" />
<ClientSettings>
<Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" />
<ClientEvents OnScroll="HandleScrolling" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
</telerik:RadAjaxLoadingPanel>
<br />
Thanks in advance for any help.
Regards,
Satyajit Kadam.
I have a radgrid with <Selecting AllowRowSelect="True" />. the radgrid is inside a radwindow. The radwindow contain a two buttons ("Select" and "Cancel") other than this radgrid. What we do is select a row in the radgrid and either click "Select" or "Cancel" button. Am sharing my radwindow here...
<div class="RadModalMainDiv"> <div> <p> Help text to go here....</p> </div> <div class="divStandardTextButtonList"> <asp:Button ID="btnObservationsTextSelect" runat="server" Text="Select" CssClass="btnStandardText" OnClientClick="return ObservationStandardText_Confirm()" /> <asp:Button ID="btnObservationsTextCancel" runat="server" Text="Cancel" CssClass="btnStandardText" /> </div> <asp:Panel ID="pnl1" runat="server"> <div> <telerik:RadGrid ID="radGdObservationsText" runat="server" AllowPaging="True" AllowSorting="False" AutoGenerateColumns="False" EnableEmbeddedSkins="false" GridLines="None" PageSize="10" Width="100%"> <MasterTableView CommandItemDisplay="None" Name="ParentGrid"> <Columns> <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn"> <HeaderStyle HorizontalAlign="Center" Width="23px" /> </telerik:GridClientSelectColumn> <telerik:GridBoundColumn DataField="description" HeaderText="Observation description" Visible="true"> </telerik:GridBoundColumn> </Columns> </MasterTableView> <PagerStyle Mode="NextPrevAndNumeric" /> <ClientSettings> <Selecting AllowRowSelect="True" /> <ClientEvents OnRowSelected="SetObservationStandardText" OnRowDeselected="SetObservationStandardText" /> </ClientSettings> </telerik:RadGrid> </div> </asp:Panel></div>
My issue is when i select a row from the radgrid, click 'select/cancel' the reopens the radwindow, the row in the radgrid remains selected. I need to de-select all the rows while reopening the radwindow. Binding of the grid is done in server side in the radGdObservationsText_NeedDataSource event. Can this be invoked using javascript? Or can you suggest any client side event of radgrid where i can de-select the rows?
Thanks for all help in prior.
RadEditor1.ImageManager.ViewPaths = New String() {"ROOT/"}