Skip to content

How to write the code for search criteria in asp.net????

Vsv Pp

Asked Feb 12, 2015, 9:35 PM EST2 answers
Share
LinkedInX
I'm new to asp.net,can any one help me how to write the search criteria in asp.net....please check the below links because I want to write a code like this.
so can any body help me out?
 
https://career4.successfactors.com/career?company=Mindtree...In this page after clicking on button it should be redirect to next page with details like
 
 
can any one help me how to write the code for search criteria for each textbox and dropdown? 

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    http://birjugohel.blogspot.in/2013/08/search-criteria-sql-query.html?view=flipcard
    0
  • 0
     Store PROCEDURE In Sql Side Create

    ////////////////////////////////////////////////

    ALTER PROCEDURE [dbo].[DailyReportGrid_Criteria]
    @Criteria varchar(max)

    AS
    declare @Condition as varchar(max)                       
    SET @Condition =''

    BEGIN
        SET @Condition ='
        With a as (
    select Count(ClientMaster.ClientId) as ClientEntry,ClientMaster.DataEnterDate,
           COUNT(FolloupMaster.intclientfolloupid)as FollowEntry,DataEnterDate,FolloupMaster,
           Count(LeadMaster.intLeadId) as LeadEntry,LeadMaster.dtleadDate,
           COUNT(QuotationMasterNew.QuotationId) as QuotationEntry,QuotationMasterNew.SubmitDate,       
           COUNT(InvoiceMasterNew.InvoiceId) as InvoiceEntry,InvoiceMasterNew.InvoiceDate,
           COUNT(PaymentMaster.PaymentId) as PaymentEntry,PaymentMaster.PaymentDueDate
    from
            ClientMaster,
            FolloupMaster,
            LeadMaster,
            QuotationMasterNew,
            InvoiceMasterNew,
            PaymentMaster
             )
            select EmployeeMaster.intEmployeeID,
            (EmployeeMaster.strFirstName + '' '' + isnull(EmployeeMaster.strMiddleName, '''') + '' '' + EmployeeMaster.strLastName) as FullName,
            a.ClientEntry,a.FollowEntry,a.LeadEntry,a.QuotationEntry,a.InvoiceEntry,a.PaymentEntry,
            ClientMaster.DataEnterDate,FolloupMaster.dtFollowDate,LeadMaster.dtleadDate,QuotationMasterNew.SubmitDate,InvoiceMasterNew.InvoiceDate,PaymentMaster.PaymentDueDate
            --a.DataEnterDate,a.dtFollowDate,a.dtleadDate,a.SubmitDate,a.InvoiceDate,a.PaymentDueDate
             from a,EmployeeMaster,ClientMaster,FolloupMaster,LeadMaster,QuotationMasterNew,InvoiceMasterNew,PaymentMaster ' + '' + @Criteria + ''
       
       
        print @Condition
       
        exec(@Condition)
       
        END

    //////////////////////////////////////////////

    Cs Code In Button Click Event To Write Code .............................

    ////////////////////////////////////////////
    string  SearchCriteria = " WHERE 1=1 ";

            if (Session["Role"].Equals("Admin"))
            {
                if (ddlEmployee.SelectedIndex != 0 && ddlEmployee.SelectedIndex != -1)
                {
                    SearchCriteria = SearchCriteria + " AND EmployeeMaster.intEmployeeId=" + Convert.ToInt16(ddlEmployee.SelectedValue) + "";
                }
            }
            else if (Session["Role"].Equals("Operator"))
            {
                SearchCriteria = SearchCriteria + " AND EmployeeMaster.intEmployeeId=" + Convert.ToInt16(ddlEmployee.SelectedValue) + "";
            }


            //if (ddlEmployee.SelectedIndex != 0)
            //{
            //    SearchCriteria = SearchCriteria + " AND EmployeeMaster.intEmployeeID=" + Convert.ToInt16(ddlEmployee.SelectedValue) + "";
            //}
            if (ddlCompanyName.SelectedIndex != 0)
            {
                SearchCriteria = SearchCriteria + " AND InvoiceMAsterNew.CompanyId=" + Convert.ToInt16(ddlCompanyName.SelectedValue) + "";
            }
            if (txtTodate.Text != "")
            {
                SearchCriteria = SearchCriteria + " AND InvoiceMAsterNew.InvoiceDate>='" + txtTodate.Text.ToString() + "'";
            }
            if (txtFromdate.Text != "")
            {
                SearchCriteria = SearchCriteria + " AND InvoiceMAsterNew.InvoiceDate<='" + txtFromdate.Text.ToString() + "'";
            }


            Session["criteria"] = SearchCriteria.ToString();
            Session["criteria"] = Session["criteria"].ToString().Replace("''", "'");
            Response.Redirect("InvoiceSummaryReportResult.aspx");

    ////////////////////////////////////
    0