ASP:DropDownList in ItemTemplate: Why is SelectedValue attribute allowed?

后端 未结 2 1313
逝去的感伤
逝去的感伤 2020-12-20 13:31

This piece of code


             


        
2条回答
  •  情歌与酒
    2020-12-20 13:48

    in markup use SelectedValue='<%# "32" %>' syntax .(note the order of single and then the double quotes in the following example ):

     
      
    

    or in code-behind just after DataBinding .(example):

      ddlField.DataSource = Fields.SelectAll();
      ddlField.DataBind();           
      ddlField.SelectedValue = "32";
    

提交回复
热议问题