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
Code:
private void DoSearch(bool resetAtoZ) :
{//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:

Code:
<tr>
<td colspan="5">
<iewcc:tabstrip autopostback="false" height="25" id="TabStrip_Control_Companies" runat="server" TabSelectedStyle="font-size: 0.8em; font-weight: bold; color: #000000; background-color: #CCCCCC; border-color: #FFFFFF;" TabHoverStyle="background-color: #CCCCCC;" TabDefaultStyle="font-size: 0.8em; font-weight: bold; color: #666666; text-decoration: none; background-color: #B8B8B8; border-color: #FFFFFF;" SepDefaultStyle=" background-color: #FFFFFF; border-color: #FFFFFF;" 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
Code:
<asp:LinkButton ID="btnSearch" cssclass="CommandButton" Text="Search" Runat="server" onclick="btnSearch_Click" />
Then it will call function :
Code:
protected void btnSearch_Click(object sender, System.EventArgs e){...DoSearch(true);};