6 Answers, 1 is accepted
0
Accepted
Hi Jing,
Here is how to do this:
Best wishes,
Dimo
the Telerik team
Here is how to do this:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
script
runat
=
"server"
>
protected void RadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
DataTable dt = new DataTable();
DataRow dr;
int colsNum = 4;
int rowsNum = 6;
string colName = "Column";
for (int j = 1; j <= colsNum; j++)
{
dt.Columns.Add(String.Format("{0}{1}", colName, j));
}
for (int i = 1; i <= rowsNum; i++)
{
dr = dt.NewRow();
for (int k = 1; k <= colsNum; k++)
{
dr[String.Format("{0}{1}", colName, k)] = String.Format("{0}{1} Row{2}", colName, k, i);
}
dt.Rows.Add(dr);
}
(sender as RadGrid).DataSource = dt;
}
</
script
>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
meta
http-equiv
=
"content-type"
content
=
"text/html;charset=utf-8"
/>
<
title
>RadControls</
title
>
<
style
type
=
"text/css"
>
.myCursor,
.myCursor *
{
cursor:crosshair !important;
}
</
style
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
Skin
=
"Office2007"
OnNeedDataSource
=
"RadGrid_NeedDataSource"
>
<
ClientSettings
AllowRowsDragDrop
=
"true"
>
<
Selecting
AllowRowSelect
=
"true"
/>
<
ClientEvents
OnRowDragStarted
=
"applyCursor"
OnRowDropped
=
"removeCursor"
OnRowSelected
=
"removeCursor"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
<
script
type
=
"text/javascript"
>
function applyCursor(sender, args)
{
Sys.UI.DomElement.addCssClass(document.documentElement, "myCursor");
}
function removeCursor(sender, args)
{
Sys.UI.DomElement.removeCssClass(document.documentElement, "myCursor")
}
</
script
>
</
form
>
</
body
>
</
html
>
Best wishes,
Dimo
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items
0
jing
Top achievements
Rank 1
answered on 30 Sep 2010, 04:09 AM
Thanks! It's works
0
jing z
Top achievements
Rank 1
answered on 19 Nov 2010, 03:12 AM
There is a bug when i drag the row and drop it on the same row, the cursor do not change back but if drag to other rows and drop, it will change back...
Anyone can help? Don't seem to find the client event for OnRowDragEnded or something. I'm using 2009Q3 1314
Thanks in advance.
Anyone can help? Don't seem to find the client event for OnRowDragEnded or something. I'm using 2009Q3 1314
Thanks in advance.
0
Hi Jing,
I can't reproduce such a behavior locally - the OnRowDropped event is always fired when you drop rows, no matter where you drop them. And the cursor is changed back to its default state. There is also an OnRowDropping event that you can use, although I don't see a reason for this.
If you provide a runnable demo, I will take a look. Thanks.
Kind regards,
Dimo
the Telerik team
I can't reproduce such a behavior locally - the OnRowDropped event is always fired when you drop rows, no matter where you drop them. And the cursor is changed back to its default state. There is also an OnRowDropping event that you can use, although I don't see a reason for this.
If you provide a runnable demo, I will take a look. Thanks.
Kind regards,
Dimo
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
jing
Top achievements
Rank 1
answered on 24 Nov 2010, 05:56 AM
Please can refer to http://www.telerik.com/community/forums/aspnet-ajax/grid/right-click-on-contextmenu-will-trigger-onrowdragstarted.aspx for the code. These code have 2 issue to it
Drag the select row, move and drop it within the selected row.
Thanks.
Drag the select row, move and drop it within the selected row.
Thanks.
0
Hi Jing,
If you look again in my demo, you will see that the custom cursor is removed also in OnRowSelected. Please modify your code.
Best wishes,
Dimo
the Telerik team
If you look again in my demo, you will see that the custom cursor is removed also in OnRowSelected. Please modify your code.
Best wishes,
Dimo
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.