473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

QUERY: Adding more JS/DOM attributes to DataGrids

I know that JavaScript lets us add:

ondragenter, ondragover, ondragleave, ondrop

events to normal HTML table td tags. This lets us do highlighting of
table cells/rows, and capture drag & drop events. So to handle
ondrop we can use javascript:

this.OnDrop = function(obj) {
obj.parentElement.style.backgroundColor = "white";
var strData = window.event.dataTransfer.getData("text");
this.InsertRow(obj.parentElement.rowIndex, strData);
window.event.cancelBubble = true;
}

The obj is the object that was dropped onto. So obj.parentElement is
the tr element, etc. Does all tr elements implicitly have a rowIndex
member which contains the row number of the table?

What am wondering is how can one add the ondrop="" attribute to a
table which was generated from a DataGrid? If it is not possible
adding JavaScript/DOM attributes to DataGrid's generated tables, then
is there any way to capture these window.events and knowing exactly
which DataGrid table row/cell it was dragged onto?

I was told to look for "DataGrid Overviews" at 4guysfromrolla.com but
could not find anything about it. Not even google.com could help. Is
there no drag and dropping support for ASP.NET datasource tables?
May 10 '06 #1
1 1312
I tend to add javascript event handlers from an external js file. That
leaves my HTML cleaner, not that it makes much difference after ASP.Net
has added its fluff.

var myTable = document.getElementById("someId");
myTable.onDrop = function(){...}

And yes, rowIndex is a property of the TableRow object.

Note that your code example there will only work in IE, for
cross-browser functionality, you'll have to work a little harder, but I
think script.aculo.us includes drag/drop support in the usual slick way.

May 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul Dunstone | last post by:
Hi group I am trying to add a custom attribute to all .NET elements such as textboxes, labels, datagrids etc. I want to add an attribute called 'key'. I already have the code working for the...
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
3
by: Joe Molloy | last post by:
Hey again, Anybody have any ideas about how I would go about adding attributes to the listitems in a databound dropdownlist? Asp.net debugger has kindly informed me that dropdown list is not a...
6
by: Bart Schelkens | last post by:
Hi, I have another question. On my asp-page I put a label. I manually create a table and set that table in the text of the label. This way my table is displayed. My question is how can i...
1
by: Srinivasa Rao | last post by:
I have binded the two datagrids from database from two different tables. In both datagrids, the first column contains checkbox. In between the datagrid, i have "Add -->" and "Remove -->" buttons in...
3
by: J'son | last post by:
Guys, I have created a custom class that derives from DataList so that I can add some custom client side functionality into each new item row (<td>). Heres the class in its simplest form: ...
1
by: Dhruba Bandopadhyay | last post by:
I know that JavaScript lets us add: ondragenter, ondragover, ondragleave, ondrop events to normal HTML table td tags. This lets us do highlighting of table cells/rows, and capture drag & drop...
2
by: Ken Fine | last post by:
In code, I'm adding javascript attributes to form elements on an ASP.NET page: body.Attributes.Add("onClick", "highlight(event);"); body.Attributes.Add("onKeyUp", "highlight(event);");...
5
by: Bob B. | last post by:
I've been playing with descriptors lately. I'm having one problem I can't seem to find the answer to. I want to assign a descriptor to a list of attributes. I know I should be able to add these...
2
by: jkwok | last post by:
Hi, I have a table that needs extra attributes added to it after a certain amount of processing has been completed. For example Table A has two fields x and y. A x y And now, I need to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.