Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8987443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:47:39+00:00 2026-06-15T21:47:39+00:00

I do not understand how implement logic for saving chosen parameters after click ‘Search’

  • 0

I do not understand how implement logic for saving chosen parameters after click ‘Search’

there is aspx file:

<form class="search_css" runat="server">
    <div class="search_div_search_box">
         <table class="filter_component_css">
              <tr>
                  <td>miap</td>
                  <td><asp:TextBox CssClass="search_format" ID="miap_textbox" runat="server"></asp:TextBox></td>
              </tr>
              <tr>
                   <td>purchase order</td>
                   <td><asp:TextBox CssClass="search_format" ID="po_textbox" runat="server"></asp:TextBox></td>
              </tr>
              <tr>
                   <td>material desc</td>
                   <td><asp:TextBox CssClass="search_format" ID="material_desc_textbox" runat="server"></asp:TextBox></td>
              </tr>
              <tr>
                   <td>supplier</td>
                   <td><asp:TextBox CssClass="search_format" ID="supplier_textbox" runat="server"></asp:TextBox></td>
              </tr>
              <tr>
                   <td>manufacturer</td>
                   <td><asp:TextBox CssClass="search_format" ID="manufacturer_textbox" runat="server"></asp:TextBox></td>
              </tr>
              <tr>
                   <td>spare parts</td>
                   <td><asp:CheckBox CssClass="search_format" ID="parts_checkbox" runat="server" OnCheckedChanged="spareParts_Checked" ViewStateMode="Enabled"/></td>
              </tr>
              <tr>
                   <td>first fills</td>
                   <td><asp:CheckBox CssClass="search_format" ID="fills_checkbox" runat="server" OnCheckedChanged="firstFills_Checked" ViewStateMode="Enabled"/></td>
              </tr>
              <tr><td>special tools</td>              
                  <td><asp:Checkbox CssClass="search_format" ID="tools_checkbox" runat="server" OnCheckedChanged="specialTools_Checked" ViewStateMode="Enabled"/>
                  </td>
              </tr>
              <tr>
                  <td colspan="2">
                      <asp:Button ID="buttonReset"  CssClass="filter_component_css_3" runat="server" Text="Reset" OnClick="submitResetClick"/>
                      <asp:Button ID="buttonSearch"  CssClass="filter_component_css_3" runat="server" Text="Search" OnClick="submitSearchClick"/>
                  </td>
              </tr>
         </table>
    </div>
</form>

c# class:

<script runat="server">
    //spare parts variable 
    int sp_id=0; 

    //first fills variable 
    int ff_id=0;

    //special tools variable 
    int st_id=0;


    void spareParts_Checked(Object sender, EventArgs e)
    {
        if (parts_checkbox.Checked)
        {
            sp_id = 1;
        }
    }

    void firstFills_Checked(Object sender, EventArgs e)
    {
        if (fills_checkbox.Checked)
        {
            ff_id = 1;
        }
    }

    void specialTools_Checked(Object sender, EventArgs e)
    {
         if (tools_checkbox.Checked)
         {
             st_id = 1;
         }
    }


    protected void submitSearchClick(object sender, EventArgs e)
    {
         ViewState.Add("flag", true);
         ViewState.Add("sp_id", sp_id);
         ViewState.Add("ff_id", ff_id);
         ViewState.Add("st_id", st_id);

         GridViewS.DataSource = SqlDataSource_Search;

         Response.Write("miap like '%" + miap_textbox.Text + "%' and pocode like '%" + po_textbox.Text + "%' and materialdescription like '%" + material_desc_textbox.Text + "%' and suppliername like '%" + supplier_textbox.Text + "%' and manufacturername like '%" + manufacturer_textbox.Text
                                + "%' and spareparts =" + sp_id + " and firstfills=" + ff_id + " and specialtools =" + st_id + "");


         SqlDataSource_Search.FilterExpression = "miap like '%" + miap_textbox.Text + "%' and pocode like '%" + po_textbox.Text + "%' and materialdescription like '%" + material_desc_textbox.Text + "%' and suppliername like '%" + supplier_textbox.Text + "%' and manufacturername like '%" + manufacturer_textbox.Text
                                + "%' and spareparts =" +sp_id+ " and firstfills=" +ff_id+ " and specialtools =" + st_id + "";

         GridViewS.DataBind();

    }
</script>

e.g.
if I check 3 check-boxes – spare parts, first fills, special tools – click ‘Search’ >
response write result:
… and spareparts =1 and firstfills=1 and specialtools =1

if after that I uncheck first fills only – click ‘Search’ >
… and spareparts =0 and firstfills=0 and specialtools =0

Result which I need:
… and spareparts =1 and firstfills=0 and specialtools =1

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:47:41+00:00Added an answer on June 15, 2026 at 9:47 pm

    Use CheckBoxList instead and tweak this for your requiement :

    aspx

    <asp:CheckBoxList ID="chklBidType" runat="server">
     <asp:ListItem Text="spare parts" Value="1" />
     <asp:ListItem Text="first fills" Value="2" />
     <asp:ListItem Text="special tools" Value="3" />
    </asp:CheckBoxList>
    

    cs

    protected void Button1_Click(object sender, EventArgs e) 
    {
     string strBidType = "";
     foreach(ListItem cBox in chklBidType.Items) 
     {
       if(cBox.Selected) 
       {
        strBidType += cBox.Value + " / ";
       }
     }
     Response.Write(strBidType);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi! I'm trying to implement an alpha-beta search, but i first want to understand
I’m learning cocoa (not ios) and I want to understand and implement MVC in
I simply could not understand why the following code does not work. What could
I do not understand why this error occurs...Is this a bug in XE, or
I do not understand pointers. Where can I learn more about them?
I simply do not understand why both works: this.timer.Tick += new EventHandler(timer_Tick); this.timer.Tick +=
I do not understand what environment a eval or exec statement executes in. You
I do not understand this error, do not generate error in JsonResult Test (),
I do not understand how to use enumeration types. I understand what they are,
I do not understand why the dialog will not work for width in Firefox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.