Link to home
Start Free TrialLog in
Avatar of Peter Chan
Peter ChanFlag for Hong Kong

asked on

Problem to DDL

Hi,
I have the condition shown below
   
     sql = "select code,dscr from c_status where deleted = '0' and dscr in('便利店要求回收','已回收','退回SF') and system = 'OK' order by id ";
        ddlStatus3.DataSource = dt;
        ddlStatus3.DataValueField = "code";
        ddlStatus3.DataTextField = "dscr";
        ddlStatus3.DataBind();
		...

Open in new window

to only show the items above, while the page having this
   
             <td style="width:70px">狀態 :</td>
                <td style="width:114px">
                    <asp:DropDownList ID="ddlStatus3" runat="server">
                    </asp:DropDownList>
                </td>
				...

Open in new window

is not showing the 3 items as expected, while on the same page, there is no other DataBind to the DDL. why?
Avatar of srikanthreddyn143
srikanthreddyn143

Did you remove the execute query part in the above code Purposefully? Or you didn't implement the part of executing the query?
Avatar of Peter Chan

ASKER

I did already have the databind as shown in above. I do not see any other codes refreshing the DDL.
But where are you querying database?
I have query to bind to the DDL in above, right?
ASKER CERTIFIED SOLUTION
Avatar of srikanthreddyn143
srikanthreddyn143

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try above links on how to populate dropdown or combo boxes
Yes, I know the way.

but the only issue is, why I can't apply the criteria to the DDL and only show the expected records as expected?
Any other help?
Can you post the full code on how you are querying the database.

also...can you post the code from where you are loading the dropdown list?
I only have these codes
        sql = "select code,dscr from c_status where deleted = '0' and dscr in('便利店要求回收','已回收','退回SF') and system = 'OK' order by id ";
        ddlStatus3.DataSource = dt;
        ddlStatus3.DataValueField = "code";
        ddlStatus3.DataTextField = "dscr";
        ddlStatus3.DataBind();

Open in new window

to initialize the DDL.
But where is that code in code behind file...