none
Bind sqldatasource at dropdownlist refer txtdate RRS feed

  • Question

  • I want to bind sqldatasource at dropdownlist according txtdate. Coding for dropdownlist

    <asp:DropDownList ID="ddlNewJobOrder" DataTextField="name" DataValueField="value"
                            runat="server" AppendDataBoundItems="True" 
            DataSourceID="NewJobOrderDS" ToolTip="New Job Order List" Width="110px" 
            AutoPostBack="True" 
            OnSelectedIndexChanged="ddlNewJobOrder_SelectedIndexChanged">

    I want to populate it according date

    <asp:SqlDataSource ID="NewJobOrderDS" runat="server" SelectCommand="SELECT Ref_No as name, Job_Order_ID as value FROM Job_Order WHERE Status <> 'JO_Completed' and Delivery_Date = @jaDate1 ORDER BY Ref_No" OnSelecting="NewJobOrderDS_Selecting">
         <SelectParameters>
         <asp:ControlParameter ControlID="JADate1" Name="jaDate1" PropertyName="Text" Type="DateTime"/>                                
         </SelectParameters>
    </asp:SqlDataSource>

    but no data populate to dropdownlist after i choose date.

    protected void ddlNewJobOrder_SelectedIndexChanged(object sender, EventArgs e)
    {
        this.setJO();
    }
    
    protected void setJO()
    {
        string joid = ddlNewJobOrder.SelectedValue;
        joid = sctt.utility.GetValue.ObjectToString(dbu.GetSQLValue("SELECT TOP (1) Job_Order_ID FROM Job_Order WHERE (Status <> 'JO_Completed') ORDER BY Ref_No"));
        if(!IsPostBack)
            JADate1.Text = DateTime.Now.ToString(DateTimeHelper.DateTimeHelper.DefaultDateFormat);
        JOType1.Text = lht.LHTWageCalculation.GetJobOrderType(joid, "");
        gvJOAssignment.DataBind();
    
    }



    Wednesday, August 7, 2013 6:51 AM

Answers