Setting active item in dropdownlist

/ Published in: C#
Save to your folder(s)

Copy this code and paste it in your HTML
  1. ddlSizeGuide.DataBind();
  2. string sizeGuideId = dtbProductDeb.Rows[0]["sizeGuideId"].ToString();
  3. ListItem liSizeGuide = ddlSizeGuide.Items.FindByValue(sizeGuideId);
  4. int indexOfDD = ddlSizeGuide.Items.IndexOf(liSizeGuide);
  5. ddlSizeGuide.SelectedIndex = indexOfDD;

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.