Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a multiple keyword search and I want to make multiple tab to display search result for each keyword. Here is what I tried:
When user enter "keyword1; keyword2; keyword3" then click search, I will call
private void DoSearch(bool resetAtoZ):

C#
//Process processes input String
       String sProcesses = txtProcesses.Text;
       string[] arrProcess = sProcesses.Split(';');

       for (int i = 0; i < arrProcess.Length; i++)
       {

           CompaniesDatagrid control = (CompaniesDatagrid)LoadControl("~/WMCCM/Companies/CompaniesDatagrid.ascx");
           //control.KeywordProcess = arrProcess[i];

           control.ProcessInputClause = arrProcess[i];
           control.SkillInputClause = txtSkills.Text;
           control.KeywordInputClause = txtKeyword.Text;
           ...
           control.ReloadDetails();//This is the function to make db query and bind data to the display.

           InSearch = true;

           //add process Tab
           bool exists = false;

           foreach (object ix in TabStrip_Control_Companies.Items)
           {
               if (ix is Tab && ((Tab)ix).Text == arrProcess[i])
               {
                   exists = true;
               }
           }
           if (exists == false)
           {
               Tab tab = new Tab();
               tab.Text = String.Format("{0}", arrProcess[i]);
               tab.ToolTip = String.Format("Search by '{0}'", arrProcess[i]);

               this.TabStrip_Control_Companies.Items.Add(tab);
               TabSeparator sep = new TabSeparator();
               this.TabStrip_Control_Companies.Items.Add(sep);
           }

           PageView pageView = new PageView();
           pageView.Controls.Add(control);

           this.MultiPage_Control_Companies.Controls.Add(pageView);


       }

In my ascx file I define:
ASP.NET
 <td colspan="5">
        <iewcc:tabstrip autopostback="false" height="25" id="TabStrip_Control_Companies" runat="server" " Targetid="MultiPage_Control_Companies"></iewcc:tabstrip>
        <iewcc:MultiPage id="MultiPage_Control_Companies" runat="server"></iewcc:MultiPage>
    </td>
</tr>


I can see the tabs created with the name of each keyword, but I can only see the first result query of the first keyword. When I click to the next tab, I feel like it reload the page and there is no result under this tab. Why the other tab cannot add the new pageview with new control search result ? My suspect is that it is because button posts back after clicking. The id property of the pageview is not persisted to the server side at the time being which effectively prevents the tab from knowing its associated pageview. how could I preventing the button from posting back?The search button is
ASP.NET
<asp:LinkButton ID="btnSearch" cssclass="CommandButton" Text="Search" Runat="server" onclick="btnSearch_Click" />&nbsp;</pre>
Then it will call function : protected void btnSearch_Click(object sender, System.EventArgs e){...DoSearch(true);};
Posted
Updated 28-Aug-14 0:07am
v4
Comments
gggustafson 27-Aug-14 9:51am    
Are you using a third party control?

In you code get rid of all the style tags. They have nothing to do with the question.
nobtiba 27-Aug-14 23:07pm    
Are you mentioning this line : CompaniesDatagrid control = (CompaniesDatagrid)LoadControl("~/WMCCM/Companies/CompaniesDatagrid.ascx"); ? It is another piece of code that related to the process.
gggustafson 28-Aug-14 0:05am    
I was referring to "iewcc".

If you are not going to do as I suggest (get rid of the style declarations) then I have nothing further to say.
nobtiba 28-Aug-14 6:09am    
Yes, I updated that part. Remove the style at iewcc. Sorry for delay, the editor here is a little bit unfriendly to me. Is there anything else I can make it clearer? Will do anything to get solution for this problem!
gggustafson 28-Aug-14 10:03am    
To answer your post back question, write the button onclick code in Javascript.

You appear to be using third party controls with which I am unfamiliar. If you were using a DataGrid or DataGridView control, I might be able to help.

Is iewcc:tabstrip correctly spelled?

I do not know how TabStrip and MultiPage interact.

I'd use TabControl and DataGridView controls to solve the problem without a third party.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900