asp.net dropdown list findbytext

后端 未结 2 609
眼角桃花
眼角桃花 2021-01-15 16:39

I am using the following to select have the dropdown list select an item from the list:

    ddlIndustry.Items.FindByText(\"Trucking\").Selected = true;
         


        
2条回答
  •  鱼传尺愫
    2021-01-15 17:18

    Try using ClearSelection to clear previous selection:

    ddlIndustry.ClearSelection();
    if (ddlIndustry.Items.FindByText("Cards") != null)
        ddlIndustry.Items.FindByText("Cards").Selected = true;
    

提交回复
热议问题