c# - Retrieving Data from BLL to labels -
i have problem regards on passing value listpageobj show value on labels. how can able value?
bll
public list<listpageobj> mylist(int itemid) { return (from in ctx.item a.itemid == itemidselect new listpageobj { item1= a.item1, item2= a.item2, item3= a.item3 }).tolist<listpageobj>(); } listpageobj
public string item1 { get; set; } public string item2 { get; set; } public string item3 { get; set; } aspx
<asp:label id="label1" runat="server" /> <asp:label id="label2" runat="server" /> <asp:label id="label3" runat="server" /> aspx.cs ?
//code retrieve item1, item2, item3 value bll label1.text = listpageobj.item1; // gives me null value label2.text = listpageobj.item2; // gives me null value label3.text = listpageobj.item3; // gives me null value
aspx.cs page
listpageobj objitem = classname.mylist(itemid); label1.text = objitem.item1; label2.text = objitem.item2; label3.text = objitem.item3; bll
public listpageobj mylist(int itemid) { return (from in ctx.item a.itemid == itemidselect new listpageobj { item1= a.item1, item2= a.item2, item3= a.item3 }).firstordefault(); }
Comments
Post a Comment