databind problem

Posts   
 
    
Posts: 97
Joined: 29-Apr-2009
# Posted on: 29-Aug-2009 07:14:08   

Hello All,

i am using llblgen 2.6 and self servicing and my database is my sql.

i have one table called : primaryindustry

in that table i have following fields

PrimaryIndustryID and PrimaryIndustryName

i can bind my dropdownlist by following code and it works fine


   PrimaryindustryCollection ClaPrimary = new PrimaryindustryCollection();
                FetchData ClaPrimaryIndustry = new FetchData();
                ClaPrimary = ClaPrimaryIndustry.FetchIndustryTitle();
                ddClassification.Items.Add(new ListItem("-- Select Primary Industry --", "-1"));
                ddClassification.DataSource = ClaPrimary;
                ddClassification.DataTextField = "PrimaryIndustryName";
                ddClassification.DataValueField = "PrimaryIndustryID";
                ddClassification.DataBind();

now i have second table called : jobdetails

in that field i have following fields

JobDetailID JobNumber ReferenceNumber IsJobLive Classification(i.e.PrimaryIndustryID )

now i want to bind drop down list primary industry as above code i have do.

but here i want only those primary industry in dropdown which has "IsJobLive" true in jobdetails.

so how can i do this?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Aug-2009 22:46:51   

Hi Sitapara,

You can specify that the selectValue of the DropDownList is binded to a specific field of job details (Classification). Is that what you are trying to do? Are you using Winforms (aspx)? Isn't easier at declarative aspx with llblgenprodatrasource?

David Elizondo | LLBLGen Support Team
Posts: 97
Joined: 29-Apr-2009
# Posted on: 31-Aug-2009 07:14:16   

daelmo wrote:

Hi Sitapara,

You can specify that the selectValue of the DropDownList is binded to a specific field of job details (Classification). Is that what you are trying to do? Are you using Winforms (aspx)? Isn't easier at declarative aspx with llblgenprodatrasource?

Hi daelmo,

Thanks for reply. well i am using aspx web form. i have two different tables. from first table : "primaryindustry" i can bind dropdownllist.

in jobdetails table i have only classification ID(i.e. PrimaryIndutryID), so i cannot get primaryindustry name directly and based on primary indutry id, i am binding my second dropdown list i.e. job Title Name

i want to bind only those data(i.e. primary industry name") which is in jobdetail table as a live job.

as i specify earlier that in "jobdetails" tables i have following fields

JobDetailID JobNumber ReferenceNumber IsJobLive Classification(i.e.PrimaryIndustryID )

so how can i bind my drop down, so i can get only those primary industry name in drop down which i has live job.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 31-Aug-2009 10:08:45   

So basicly you want to execute the following SQL:

SELECT PrimaryIndustryID, PrimaryIndustryName
FROM PrimaryIndustry
WHERE PrimaryIndustryID IN 
(SELECT Classification 
 FROM jobdetails
 WHERE IsJobLive = 1)

And for this all you have to do is to use a FieldCompareSetPredicate when fetching PrimaryIndustry entities.

Posts: 97
Joined: 29-Apr-2009
# Posted on: 01-Sep-2009 08:10:53   

Walaa wrote:

So basicly you want to execute the following SQL:

SELECT PrimaryIndustryID, PrimaryIndustryName
FROM PrimaryIndustry
WHERE PrimaryIndustryID IN 
(SELECT Classification 
 FROM jobdetails
 WHERE IsJobLive = 1)

And for this all you have to do is to use a FieldCompareSetPredicate when fetching PrimaryIndustry entities.

Thanks walaa,

exactly that i need. thanks again