copy a datagrid cell to another

G

Guest

What I want to do, I have a datagrid with totals in one column and a text
field in the next. What I would like to provide is a way for the user to
click on an arrow under/next to the total amount that would then load into
the text field. I know I could just use an edit button and have an event
handle it, but that would take too much time with the posting and post back.
I think what I want to do is write some kind of java script so that the copy
is done on the client side. Does anybody have a suggestion for me, or an
example how to do this?

I am using ASP.NET with VB

Thanks
 
G

Guest

Add to the arrow an attribute onclick with a value containing the name of a
Javascript function that traverses the browser DOM and copies the values from
one control to the other.

I modified my datagrid sample to do what you wanted and put the source code
on my website at: http://www.societopia.net/samples/datagrid.aspx
 
L

Lucas Tam

. Does anybody have a suggestion for me, or an
example how to do this?

in Javascript, take a look at document.getElementById('ClientID').innerText
(or innerHTML)

And in ASP.NET take a look at the ClientID property.

You can attach the Javascript during the datagrid's onItemDataBound event.
 
G

Guest

Thanks Phillip I got it to work. it was exacty what I was looking for. I did
have something interesting happen though. I looked at your example and the
title worked on your sample, then I tried to mimick the process in my page, i
couldn't get the title on the image to work (mouse over and then a text box
appears). So then I went back to your page to see what I was doing wrong, and
the title stopped working in yours. is there a setting that I may have
triggered with my development that told IE to not display titles?
 
G

Guest

Lyners said:
Thanks Phillip I got it to work. it was exacty what I was looking for. I did
have something interesting happen though. I looked at your example and the
title worked on your sample, then I tried to mimick the process in my page, i
couldn't get the title on the image to work (mouse over and then a text box
appears). So then I went back to your page to see what I was doing wrong, and
the title stopped working in yours. is there a setting that I may have
triggered with my development that told IE to not display titles?

Hello Lyners,

I am not aware of such a setting. The documentation for IE does not
indicate a setting that might cause the title to not display:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/img.asp

I guess you can try placing an <img> tag with a title attribute in a simple
HTML page and investigate further. It could be a simple typo somewhere in
your aspx page that caused this. Let me know if you find something more to
it than just a typo.
 
G

Guest

I checked out the MSDN page on title and the example that it has my PC
doesn't allow me to see the title. I'll research what happened here.

Thanks Phillip for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top