Is it possible to get the X and Y coordinates of a radgrid that has just been made visible? I want to scroll to the top of it as soon as it has been created.
<script type=
"text/javascript"
>
function
rgOrderDetail_OnGridCreated(sender, args) {
var
bounds =
//get bounds of the grid
scrollTo(bounds.x, bounds.y);
}
</script>
5 Answers, 1 is accepted
0
Accepted
Hi Danny,
You can use the following approach:
Hope this helps. Please give it a try and let me know if it works for you.
Regards,
Eyup
Telerik
You can use the following approach:
function
gridCreated(sender, args) {
var
offset = $(sender.get_element()).offset();
var
top = offset.top;
var
left = offset.left;
}
Hope this helps. Please give it a try and let me know if it works for you.
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
Danny
Top achievements
Rank 2
answered on 07 Nov 2013, 07:35 PM
Eyup, thanks for the stab at it.
Your first line of code is not returning an object- I'm getting an "Object Expected" error.
Using the .get_element() method off of merely the sender results in an object that doesn't support the offset() method.
Your first line of code is not returning an object- I'm getting an "Object Expected" error.
Using the .get_element() method off of merely the sender results in an object that doesn't support the offset() method.
0
Accepted
Hi Danny,
Can you please verify that you have jQuery scripts added to your page?
Looking forward to your reply.
Regards,
Eyup
Telerik
Can you please verify that you have jQuery scripts added to your page?
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
Looking forward to your reply.
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
Danny
Top achievements
Rank 2
answered on 21 Nov 2013, 02:32 PM
Yes, Eyup, I had created a second master page and did not have those scripts referenced in script manager.
The following works perfectly-
Thank you for your help- can I award *you* Telerik points?
The following works perfectly-
function
rgOrderDetail_OnGridCreated(sender, args) {
var
offset = $(sender.get_element()).offset();
var
top = offset.top;
window.scrollTo(0, top);
}
Thank you for your help- can I award *you* Telerik points?
0
Hi Danny,
I am glad that the issue was resolved.
Your appreciation is totally enough.
Regards,
Eyup
Telerik
I am glad that the issue was resolved.
Your appreciation is totally enough.
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.