I have an asp.net website in which I'm using an AJAX TabContainer. Within this container I have one TabPanel. Inside this panel I want to have a close button which would, upon clicking, close (visible=false) this panel.
Sample:
<cc1:TabContainer ID="tbcMain" runat="server" Width="100%" ActiveTabIndex="0" CssClass="Tab">
<cc1:TabPanel ID="tbp1" runat="server" Visible="false">
<HeaderTemplate>
<asp:Label ID="lbl_tbp1_Title" runat="server"></asp:Label>
<asp:ImageButton ID="imb_tbp1_Close" runat="server" ImageUrl="~/Images/cross.png" />
</HeaderTemplate>
<ContentTemplate>
some content
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
The button imb_tbp1_Close does not cause a postback. I belive it's something with the whole region of HeaderTamplate being clickable and thus my button stays behind (like a z-index of sorts).
How can I make my button receive the click and cause a postback?
Edit, the solution I'm using now:
Firstly I could use an actual button event in the code-behind but ImageButton control does not have the property UseSubmitBehavior to set it false. So I handle the event in my Page_Load.
<cc1:TabPanel ID="tbpCust_1" runat="server" Visible="false">
<HeaderTemplate>
<asp:Label ID="lbl_UC_CUSTO_1_Title" runat="server"></asp:Label>
<asp:ImageButton ID="imb_CUSTO_Close_1" runat="server" ImageUrl="~/Images/cross.png" OnClientClick="javascript:__doPostBack('imb_CUSTO_Close_1', '0')" />
</HeaderTemplate>
<ContentTemplate>
<ucCUSTO:UC_CUSTO ID="UC_CUSTO_1" runat="server" />
</ContentTemplate>
</cc1:TabPanel>
and in the code-behind:
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim evtTarg As String = Request.Form("__EVENTTARGET")
Dim evtArg As String = Request.Form("__EVENTARGUMENT")
If evtTarg = "imb_CUSTO_Close_1" Then
UC_CUSTO_1.clear_fields()
tbcStranke.Tabs(0).Visible = False
ElseIf evtTarg = "imb_CUSTO_Close_2" Then
UC_CUSTO_2.clear_fields()
tbcStranke.Tabs(1).Visible = False
End If
End Sub