How do I find grid view control value name in aspx.vb

I have a function in my code behind (.aspx) called:
function ChangeFU() {
document.getElementById("CM1_GridView1_ctl02_ddlFU").selectedIndex = document.getElementById("ddlNameValue").selectedIndex;
}

Where do I find where the "CM1_GridView1_ctl02_ddlFU" control value is defined/declared?
66chawgerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MrunalCommented:
Hi
Here are the two ways in which you can achieve this:

1. From code behind you are calling function ChangeFU(), so you can pass selected value from code behind itself as a parameter to same function.

2. Another way is if you can not pass this selected value as a parameter, then you can get it from JavaScript like:

var e = document.getElementById("CM1_GridView1_ctl02_ddlFU");
var ddlFUValue = e.options[e.selectedIndex].value;

var e = document.getElementById("CM1_GridView1_ctl02_ddlFU");
var ddlFUText = e.options[e.selectedIndex].text;

but, provided given id of dropdown is client id.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
66chawgerAuthor Commented:
Mrunal, thanks for the reply.   Is this element id being generated automatically?  For some more background, my original post relates to an existing drop-down box... so this one is good.   I subsequently created/added another drop-down for a field on the grid that was previously text.  I am going through the code behind the .aspx as well as the aspx.vb  to replicate what exists for the drop-down mentioned previously.   The last piece for the new drop-down is the addition of a function derived from the existing one.  I assume the id in question is unique to that field?  When adding a drop-down, is this function normally created for you, or am a correct in having to code it manually?   Sorry, I can hold my own in .NET, but I am not a hardcore .NET developer.... and what I am attempting should be simple.


New:
function changeFUE(){
    document.getElementById("CM1_GridView1_ctl02_ddlFU").selectedIndex = document.getElementById("ddlEmployeeName").selectedIndex;
    }
 
Existing:  
    function changeFU(){
    document.getElementById("CM1_GridView1_ctl02_ddlFU").selectedIndex = document.getElementById("ddlSupervisor").selectedIndex;
    }
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.