hi
in serach.aspx page I put 6 textboxs 2 dropdownlist and one image button see below image:

 
as you see I pointed dropdownlist with arrow and there are 4 textbox that 2 of them are in red color:
now see below image:

 
here when I select Item from dropdownlist that show with green arrow it will change TextBoxs...
it will make visibility=false for 4 textboxs that I show in first image and make visibility=true for 2 textboxs that are in green color and show in second image...
here in textboxs (red color and green color) I type value and it will search data in database between 2 values that I type in texboxs and will show in gridview...
it worked correctly for 2 textbox(in red color) that you can see in first image...
but when I select Item  from dropdownlist and it will show 2 textboxs in green color when I typed vlaue(number) in green textboxs it doesn't worked correctly it doesn't show any things in gridview:
now I put html of 2 textbox in red color and dropdownlist that you can see in first image:
<asp:UpdatePanel ID="UpdatePanel7" runat="server">
   <ContentTemplate>
        <div id="AmFoD12" runat="server" >
             <asp:TextBox ID="Txtrahn2" runat="server" CssClass="vadi1" ForeColor="#b1b1b1" onblur="WaterMark(this, event,'تا');" onfocus="WaterMark(this, event,'تا');" Text="تا" ></asp:TextBox>
             <asp:TextBox ID="Txtrahn1" runat="server" CssClass="vadi2" ForeColor="#b1b1b1" onblur="WaterMark(this, event,'از');" onfocus="WaterMark(this, event,'از');" Text="از"></asp:TextBox>
             <asp:Label ID="Lblrahn2" runat="server" Visible="false">0</asp:Label>
             <asp:Label ID="Lblrahn1" runat="server" Visible="false">0</asp:Label>
        </div>
   </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel5" runat="server">
    <ContentTemplate>
        <asp:DropDownList ID="Ddlvagozari" runat="server" CssClass="ddlvag" AutoPostBack="true" OnSelectedIndexChanged="ddlTran_OSIC"></asp:DropDownList>
    </ContentTemplate>
</asp:UpdatePanel>
and below code are for 2 textboxs in green color (in second image):
<asp:UpdatePanel ID="UpdatePanel6" runat="server">
     <ContentTemplate>
           <div id="AmFoD12fo" runat="server" visible="false">
                 <asp:TextBox ID="Txtforosh2" runat="server" CssClass="vadi1f" ForeColor="#b1b1b1" onblur="WaterMark(this, event,'تا');" onfocus="WaterMark(this, event,'تا');" Text="تا"/></asp:TextBox>
                 <asp:TextBox ID="Txtforosh1" runat="server" CssClass="vadi2f" ForeColor="#b1b1b1" onblur="WaterMark(this, event,'از');" onfocus="WaterMark(this, event,'از');" Text="از"  visible="false"></asp:TextBox>
                 <asp:Label ID="Lblforosh1" runat="server" Visible="false">0</asp:Label>
                 <asp:Label ID="Lblforosh2" runat="server" Visible="false">0</asp:Label>
           </div>
     </ContentTemplate>
</asp:UpdatePanel>
 
as you see I put all textboxs and dropdown list in updatepanel control..
and below is code for dropdownlist selected Item:
protected void ddlTran_OSIC(object sender, EventArgs e)
{
    string code = Ddlvagozari.SelectedItem.Text;
    switch (code)
    {
        case "رهن کامل":
        case "رهن/اجاره":
        case "اجاره":
             AmFoD12.Visible = Txtrahn2.Visible = Txtrahn1.Visible = true;
            AmFoD12fo.Visible =  Txtforosh1.Visible = Txtforosh2.Visible = false;
            Txtforosh1.Text = "از";
            Txtforosh2.Text = "تا";
            break;
        default:
            AmFoD12.Visible = Txtrahn2.Visible = Txtrahn1.Visible = false;
            AmFoD12fo.Visible = Txtforosh1.Visible = Txtforosh2.Visible = true;
            Txtejare1.Text = "از";
            Txtejare2.Text = "تا";
            Txtrahn2.Text = "تا";
            Txtrahn1.Text = "از";
            break;
    }
}
and below is code for button:
  private void GetEstatInfoS(int pageIndex)
    {
        string code = Txtrahn1.Text;
        switch (code)
        {
            case "از":
                Lblrahn1.Text = "0";
                break;
            default:
                Lblrahn1.Text =Txtrahn1.Text;
                break;
        }
        string rahn = Txtrahn2.Text;
        switch (rahn)
        {
            case "تا":
                Lblrahn2.Text = "0";
                break;
            default:
                Lblrahn2.Text = Txtrahn2.Text;
                break;
        }
        string ejare1 = Txtejare1.Text;
        switch (ejare1)
        {
            case "از":
                Lblejare1.Text = "0";
                break;
            default:
                Lblejare1.Text = Txtejare1.Text;
                break;
        }
        string ejare2 = Txtejare2.Text;
        switch (ejare2)
        {
            case "تا":
                Lblejare2.Text = "0";
                break;
            default:
                Lblejare2.Text = Txtejare2.Text;
                break;
        }
        string forosh1 = Txtforosh1.Text;
        switch (forosh1)
        {
            case "از":
                Lblforosh1.Text = "0";
                break;
            default:
                Lblforosh1.Text = Txtforosh1.Text.Trim();
                break;
        }
        string forosh2 = Txtforosh2.Text;
        switch (forosh2)
        {
            case "تا":
                Lblforosh2.Text = "0";
                break;
            default:
                Lblforosh2.Text = Txtforosh2.Text.Trim();
                break;
        }
        using (SqlConnection conn = General.GetConnection())
        {
            using (SqlCommand cmd = General.GetCommand("Estate_Information", conn))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@PageIndex", pageIndex);
                cmd.Parameters.AddWithValue("@PageSize", PageSize);
                cmd.Parameters.AddWithValue("@Type", Ddltype.SelectedItem.Text);
                cmd.Parameters.AddWithValue("@Transfer", Ddlvagozari.SelectedItem.Text.Trim());
                cmd.Parameters.AddWithValue("@metraj", Ddlmetraj.SelectedItem.Text.Trim());
                cmd.Parameters.AddWithValue("@rahn2", Lblrahn2.Text);
                cmd.Parameters.AddWithValue("@rahn1", Lblrahn1.Text);
                cmd.Parameters.AddWithValue("@ejare2", Lblejare2.Text);
                cmd.Parameters.AddWithValue("@ejare1", Lblejare1.Text);
                cmd.Parameters.AddWithValue("@forosh2", Lblforosh2.Text);
                cmd.Parameters.AddWithValue("@forosh1", Lblforosh1.Text);
                cmd.Parameters.Add("@RecordCount", SqlDbType.Int, 4);
                cmd.Parameters["@RecordCount"].Direction = ParameterDirection.Output;
                conn.Open();
                SqlDataReader idr = cmd.ExecuteReader();
                if (idr.HasRows)
                {
                    GrdAmlak.DataSource = idr;
                    GrdAmlak.DataBind();
        
                }
                else
                {
                    GrdAmlak.DataSource = idr;
                    GrdAmlak.DataBind();
                }
                idr.Close();
                this.PopulatePagerP(Convert.ToInt32(cmd.Parameters["@RecordCount"].Value), pageIndex);
            }
        }
    }
 
here it will passed @rahn1 and @rahn2 (red textboxs value) and @frosh1 and @frosh2 ( green text boxs value)...
now problem is that when I select Item from Dropdownlist and it will make visibility=true for (green textboxs TxtForosh1 and Txtfrosh2) when I enter value in textboxs it doen't show any things in gridview ...
I put breckpoint in:
cmd.Parameters.AddWithValue("@forosh2", Lblforosh2.Text);
cmd.Parameters.AddWithValue("@forosh1", Lblforosh1.Text);
and cheked value and see that is number that I enter in green textboxs so it will pass value but I don't know why it shows empty gridview:
this problem just happen when I select Item from dropdown list...
I think it happen becuse of Updatepanel but I don't know why...
Best regards
neda