Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to bind a variable 'v_balancestock' to datalist1 dynamically. I use data column name 'stockavailability ' from a sql table. I get an exception like 'DataBinding:
'System.Data.DataRowView' does not contain a property with the name 'v_stockavailability'.'.
The following is my code:

XML
<asp:Label ID="Label3" runat = "server"
    Text=' <%# DataBinder.Eval(Container.DataItem, "v_balancestock")%>'>
    </asp:Label>
Posted
Comments
S.Rajendran from Coimbatore 20-Feb-14 5:54am    
v_stockavailability' should be changed to 'v_balancestock'

change your code ..
C#
<asp:label id="Label3" runat="server" xmlns:asp="#unknown">
    Text=' <%# DataBinder.Eval(Container.DataItem, "stockavailability")%>'>
    </asp:label>
 
Share this answer
 
v2
interface to programmatically create data bound list control templates.

http://delphi.about.com/library/weekly/aa121305a.htm[^]

Regards,
Praveen Nelge
 
Share this answer
 
You should bind the column name and not the variable itself.
XML
<asp:Label ID="Label3" runat = "server" Text=
'<%# DataBinder.Eval(Container.DataItem, "stockavailability")%>'> 
</asp:Label>

And still, if you want to bind the variable,
C#
// in code behind...
int i = 5;
Label3.Text = "" + i;

-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900