c# - Using LINQ to select with object -
i have radio bullet list
, want set values , text of radio list using linq, return "0" when first value on database "1".
at database have 2 columns, codcategoria
, dsccategoria
, want define value of radio_bullet_list
codcategoria
, display text dsccategoria
testesiteentities db = new testesiteentities();//create object //select object rblcategoria.datavaluefield = db.categoria.select( c => c.codcategoria ).tostring(); rblcategoria.datatextfield = db.categoria.select(dc => dc.dsccategoria).tostring(); rblcategoria.databind();//define valores no bullet list
what wrong?
the datavaluefield , datatextfield both looking string representation of they're supposed use. set datasource sort of ienumerable has properties, assuming db.categoria has properties "codcategoria" , "dsccategoria" like:
testesiteentities db = new testesiteentities();//create object //select object rblcategoria.datavaluefield = "codcategoria"; rblcategoria.datatextfield = "dsccategoria"; rblcategoria.datasource = db.categoria.select().tolist(); rblcategoria.databind();//define valores no bullet list
Comments
Post a Comment