views:

314

answers:

2

i have a gridview witch contain 4 databound columns and 2 templated column. in one of template column i placed a dropdownlist(witch contain number of items). and 2nd column of gridview contains prices. so in last column i want that when i select value in dropdownlist that value should multiply with 2nd column's value of datagrid and place result in last column of gridview using java script.

please tell me what to do..

+1  A: 
rahul
its good thing to learn but not supported to solution. i want that when ever i select a value in dropdownlist (in gridview) it calls a function of javascript and i should be able to retrive that value of second field of that same row and place result in last column of same row
Rajesh Rolen- DotNet Developer
wow..this is correct solution...
Rajesh Rolen- DotNet Developer
can u please tell me more how can i do grand total of all that...?
Rajesh Rolen- DotNet Developer
i got it thanks a lot
Rajesh Rolen- DotNet Developer
+1  A: 

You should be using ClientID property of the serverside controls and document.getElementById method to access your controls using javascript.

You may find this article helpful for generating neat ClientIDs.
This forum discussion may also show you the right way out.

Upd.:
Sample html:

<table>
    <tr>
        <td>cellValue</td>
        <td><span id="comboId">combo</span></td>
    </tr>
</table>

Sample javasricpt:

// alerts "cellValue"
alert(document.getElementById("comboId").parentNode.parentNode.cells[0].innerHTML);
Li0liQ
i think you all are not getting me.. i know ClientIDs ..... ok.i have written this javascript code: function ShowTotalPrices(dropDown) { var selectedStatus = dropDown.value; //here i am getting value of my dropdownlistvar price= //tell me what should i write here to retrive value of same row in witch this dropdownlist exists who called this function }
Rajesh Rolen- DotNet Developer
@Dot Net Developer Updated the answer to meet your request.
Li0liQ