asp.net - changing selected text of dropdownlist in Gridview using javascript -


i have dropdownlist, , gridview 1 of columns dropdownlist.

both dropdown lists use same data source.

when value selected in dropdownlist (outside gridview) want chaneg selectedvalue , selecttext of every dropdownlist in gridview.

this have tried:

dropdownlist:

<asp:dropdownlist onclick="javascript:onjdselection()" id="dropdownlist3" runat="server"          datasourceid="sqldatasource4" datatextfield="circt_cstdn_nm"          datavaluefield="circt_cstdn_user_id"> 

javascript:

<script type="text/javascript"> function onjdselection() {      var jd = document.getelementbyid('dropdownlist3.clientid').selectedtext;     var grid = document.getelementbyid('gridview2.clientid');     //loop starts 1 because zeroth row header.        (var = 1; < grid.rows.length; i++) {          var othertext = grid.rows[i].cells[2].innertext; // works fine             grid.rows[i].cells[3].getelementsbyid('ddl_jd').selectedtext = jd;      } } 

when click error. says object expected. know objects exsist!

any ideas? thanks!

you use dom model instead of getting dropdownlist directly per id(asp.net changes 'ddl_jd'). know @ least cell(grid.rows[i].cells[3]). try nextsibling ...


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -