ASP.NET SelectedIndex స్పందన అంశం

నిర్వచనం మరియు ఉపయోగం

SelectedIndex స్పందన అంశం వినియోగించబడుతుంది డ్రాప్ డౌన్ లిస్ట్ లో ఎంపికబడిన అంశం సంఖ్యను పొందడానికి లేదా అంతరించడానికి ఉపయోగించబడుతుంది.

ప్రతిమానికి

ఈ ఉదాహరణ ఎంపికబడిన అంశం పదబంధాన్ని ప్రస్తుతిస్తుంది:

<script runat="Server">
Sub GetName(obj As Object, e As EventArgs)
  lbl.Text = ddList.SelectedItem.Text
End Sub
</script>
<form runat="Server">
జాబితా నుండి పేరును ఎంచుకొనండి:
<asp:DropDownList id="ddList" runat="Server">
  <asp:ListItem Text="Peter" />
  <asp:ListItem Text="Lois" />
  <asp:ListItem Text="Cleveland" />
  <asp:ListItem Text="Quagmire" />
  <asp:ListItem Text="Joe" />
</asp:DropDownList>
<asp:Button Text="Select"
OnClick="GetName" Runat="Server" />
<br />
పేరు ఉంది:
<asp:Label id="lbl" Runat="Server"/>
</form>

ప్రతిమానికి

DropDownList లోని ఒక అంశం పదబంధాన్ని పొందండి