i am displaying products in list view ! now in <itemTemplate> i'm showing the product name by doing :

<b> <%# Eval("ProductName") %></b>

now i would like to also show the price of this product. but the price is in another table since prices are different for different types of users ! so i have to get the product id and user type first in order to get the price type from the price table. so i did a label:

<label id="lblPrice" runat="server">
                             </label>

which i will be using it in the code to set its text to the price. can anyone pls let me know how i can access and edit this label from the code ?! thanks

lblPrice.Text should work for you.

no it's not being shown ! i think its all because the label is in <itemTemplate>

yes, that is correct. Sorry didnt realize that you had the label within the listview as well. You can refer to a similar discussion on the asp.net forum: Find Control in Listview

You need to define SQL statemet that fetch rows from both these tables. Please post the tables description if possible.

tblPrice

float price,
int productId,(fk)
int userTypeId,(fk)
int priceID(pk)

tblproduct

int productID,(pk)
int productName,

tblUserType

int userTypeID, (pk)
string username (fk)

tblUser

string username(pk)
....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.