Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
bind data to combobox
posted

I can't bind data to combobox, pls help me, it just show a blank combobox

My models

public class DanTocModels
    {
        [Key, Required, MaxLength(8)]
        public string MaDanToc{get;set;}
        public string TenDanToc { get; set; }
    }
}

[controller] I used to Dapper(name of controller is: CommonController) and this below is my function

 public IEnumerable get_all_dan_toc()
        {

            var rs = SqlMapper.Query(cn, "select * from tbl_dan_toc order by MaDanToc asc");

            return rs;
        }


[view]

@model

 @(Html.Infragistics().ComboFor(item => item.MaDanToc) .Width("270px") 
..DataSource(Url.Action("/common/get_all_dan_toc")) .ValueKey("MaDanToc") .TextKey("TenDanToc") .DataBind() .Render() )

Parents
No Data
Reply Children