asp.net - How to access a value which is associated with a dropdownlist item? -


this dropdown list code........

<td valign="top" align="center">    <asp:dropdownlist id="studentnamedropdownlist" runat="server" width="150px"         datasourceid="sqldatasource2" datatextfield="studentname"         datavaluefield="studentname" autopostback="true">    </asp:dropdownlist>    <asp:sqldatasource id="sqldatasource2" runat="server"         connectionstring="<%$ connectionstrings:dbbilling2.0connectionstring3 %>"          selectcommand="select [studentid], [studentname] [tblstudentinfo] ([class] = @class)">        <selectparameters>            <asp:controlparameter controlid="classdropdownlist" name="class"                 propertyname="selectedvalue" type="string" />        </selectparameters>    </asp:sqldatasource>    <br /> 


want access student id field in code behind file..how can achieve this?? syntax must use[like dropdownlist.selecteditem] ??


first of in dropdownlist asp component must set property datavaluefield="studentid", in code behind can id of selected student writing : studentnamedropdownlist.selectedvalue


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -