After the postback of the updatepanel I show a fancybox with 1 textfield and a submit button
The fancybox shows perfectly. But when I click the lbtnInsert button, nothing happens. The code-behind is never hit
**.ASPX**
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$('#help_amountpaid').tipsy();
//more details @ http://fancybox.net/blog
$("#viewtaskdetail").fancybox({
'scrolling': 'no',
'width': 500,
'height': 'auto',
'titleShow': false,
'onClosed': function () {
$("#login_error").hide();
}
});
});
</script>
<script type="text/javascript" language="javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(RunThisAfterEachAsyncPostback);
// runs each time postback is initiated by any update panel on the page
function RunThisAfterEachAsyncPostback()
{
$('#viewtaskdetail').trigger('click');
}
</script>
<a id="viewtaskdetail" title="Task details" href="#addnewitem">Try now</a>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Literal ID="ltEditItem" runat="server"/>
<div style="display:block;">
<div id="addnewitem">
<table>
<tr>
<td><asp:Literal ID="Literal2" runat="server" Text="<%$Resources:glossary,title %>" /></td>
<td>
<asp:TextBox ID="tbTitle" runat="server" CssClass="textbox" MaxLength="100" ValidationGroup="inserttask" Width="400" />
<asp:RequiredFieldValidator CssClass="errortext" ID="fdgRequiredFieldValidator1" runat="server" ControlToValidate="tbTitle" Display="Dynamic" ErrorMessage="<%$Resources:Glossary,required %>" ValidationGroup="inserttask" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="lbtnInsert" Text="<%$Resources:glossary,save %>" ValidationGroup="inserttask" OnClick="lbtnInsert_Click" CssClass="btn-primary" runat="server"/>
</td>
</tr>
</table>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="lbtnInsert" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
**code behind**
I change the contents of the tbTitle field and the ltEditItem Literal when a gridview in the same updatepanel is clicked.
Protected Sub gvTasks_OnRowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles gvTasks.RowCommand
If e.CommandName = "EditItem" Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim data As DataKey = gvTasks.DataKeys(index)
Dim objectId As Integer = data.Values("id")
ViewState("id") = objectId.ToString
Dim TATasks As New planningTableAdapters.tasksTableAdapter
Dim DTTasks As planning.tasksDataTable = TATasks.GetTaskById(objectId)
With DTTasks(0)
tbTitle.Text = .title.ToString
End With
ltEditItem.Text = "<span id=""taskid"">" + objectId.ToString + "</span>"
End If
End Sub
Protected Sub lbtnInsert_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbtnInsert.Click
ReportError("lbtnInsert_Click", "")
End Sub
I tried with and without the Triggers for the updatepanel. I also tried a regular PostBackTrigger. But nothing works,