c# - add item to dropdownlist -
i'm trying add together item dropdownlist oracle datareader, maintain getting error states line has invalid arguments.
can specify text , value? in case, want them same value coming datareader.
tref.items.add(new listitem(dr["t_ref"], dr["t_ref"]));
listitem can take 2 strings parameters, passing 2 objects. seek converting dr object string:
tref.items.add(new listitem(dr["t_ref"].tostring(), dr["t_ref"].tostring())); alternatively cleaner:
var t_ref = dr["t_ref"].tostring(); tref.items.add(new listitem(t_ref, t_ref)); http://msdn.microsoft.com/en-gb/library/system.web.ui.webcontrols.listitem.aspx
c# .net
No comments:
Post a Comment