You can't bind the SelectedValue property declaratively, but you can achieve this by using a Binding expression. As you can't use the Bind / Eval syntax outside of a databound container control, you shoud bind to one of the Page's public members, as shown below :
Page :
<asp:RadioButtonList ID="RadioButtonList1" runat="server" DataSourceID="ObjectDataSource1" DataTextField="Lib" DataValueField="Id" SelectedValue='<%# Id %>' />
Code behind :
public partial class _Default: System.Web.UI.Page{
public int Id;
protected void Page_Load(object sender, EventArgs e){
if (!IsPostBack) Id = YetAnotherDAL.GetId();
}
}
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire