i have a problem to find out how to do this: i need to be able to attach a client side jscript to a textbox of the row which is put into the edit mode and apply some business rules. There are several rows in my datagrid and when the user clicks 'edit' on a
row: that row goes into the 'edit mode' and then he/she will be able to change the value ( which is a decimal number ) in one of the textboxes and then the client side script will have the duty to keep the total of the changed value and the value of the same
column of the previous row . To show the situation: -------------Column3---Column4--- Row 4: 12.34 4.56 Row 5: 12.34 4.56 This is the row being edited. Total of Column4 of Row4 and Row5 is 9.12 so when the user writes 2.10 in Column4 of Row5 then jscript should
make Column4 of Row4 7.02 If the user writes something larger than 9.12 then jscript should raise an alert and clear the user input. I am hopeless with this! I neither know how to attach a script to a textbox in a row being edited and the script stuff. please
help!
This will add the onchange attribute to your text box, and set it to call the client-side javascript function "myClientSideFunction". Then you just have to DEFINE "myClientSideFunction" itself :-) You could probably
do that right in the *.aspx page HTH... Chris
Of course, that is the last point that will be done after finding the 'right' textbox on the datagrid :) Bur first of all, i want to learn how does asp.net give names to the 'edit' mode row's textboxes... After that, i think the script functionality is difficult,
at least for me :) May be it is too difficult that there is reply about that part!
onderA
Member
85 Points
17 Posts
attaching client side script to an edit mode textbox
Aug 28, 2003 06:24 PM|LINK
cahyde
Participant
1500 Points
298 Posts
Re: attaching client side script to an edit mode textbox
Aug 28, 2003 06:54 PM|LINK
myTextBox.Attributes("onchange", "javascript: myClientSideFunction();")This will add the onchange attribute to your text box, and set it to call the client-side javascript function "myClientSideFunction". Then you just have to DEFINE "myClientSideFunction" itself :-) You could probably do that right in the *.aspx page HTH... ChrisonderA
Member
85 Points
17 Posts
Re: attaching client side script to an edit mode textbox
Aug 29, 2003 05:05 AM|LINK