asp.net - how can i to access Control in UpdatePanel for Read value controls? -
i can't find dropdownlist ,because inside update panel other control outside update panel can find using following code:
for each c control in form1.page.controls findcontrol(c) next private function findcontrol(c control) each k control in c.controls if typeof k dropdownlist if ctype(k, dropdownlist).id = "c1" ctype(k, dropdownlist).selecteditem.value = 2 end if findcontrol(k) end if next return "" end function
////////////////////////////////////
<td class="combo_ghaza"> <asp:updatepanel id="upc1" runat="server"> <contenttemplate> <asp:dropdownlist runat="server" width="180px" id="c1" class="combo_ghaza" enableviewstate="true" font-names="myfirstfont" autopostback="true" onselectedindexchanged="c1_selectedindexchanged"> </asp:dropdownlist> <asp:dropdownlist id="cs1" runat="server" width="70px" class="combo_ghaza" initialvalue="-1" font-names="myfirstfont"> </asp:dropdownlist> </contenttemplate> </asp:updatepanel> </td>
the recursive call seems in wrong position, try move 1 line down
private function findcontrol(c control) each k control in c.controls if typeof k dropdownlist if ctype(k, dropdownlist).id = "c1" ctype(k, dropdownlist).selecteditem.value = 2 end if end if findcontrol(k) next return "" end function
Comments
Post a Comment