I got an ajaxcontrol with the following tab panel below. It contains a grid view having a Link Button. I'm trying to open a new window with the form in the code behind but when i click the Link Button I get redirected to the first panel in my tabcontrol, it doesn't look like a postback.
<ajaxcontrol:TabPanel ID="TabPnlDependents" runat="server">
<HeaderTemplate>
Dependents
</HeaderTemplate>
<ContentTemplate>
<table>
<tr>
<td>
<asp:GridView ID="DependentsGridView" DataSourceID="SqlDependentsGridView" AutoGenerateColumns="false" runat="server" DataKeyNames="PerId,PersonId" OnRowCommand="DependentsGridView_RowCommand">
<Columns>
<asp:TemplateField HeaderText="Dependent ID">
<ItemTemplate>
<asp:LinkButton runat="server" ID="BtnDepenedentForm" Text='<%# Bind("PersonId") %>' CommandName="OpenDependentForm" CommandArgument='<%# DataBinder.Eval(Container,"RowIndex") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="FullName" HeaderText="Name" />
<asp:BoundField DataField="Gender" HeaderText="Gender" />
<asp:BoundField DataField="RelationToMain" HeaderText="Relation" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>
The event for the LinkButton Row Command in the code behind is as follows:
protected void DependentsGridView_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "OpenDependentForm")
{
int index = Int32.Parse(e.CommandArgument.ToString());
GridViewRow SelectedRow = DependentsGridView.Rows[index];
String RefId = DependentsGridView.DataKeys[index].Values[0].ToString();
String DependentId = DependentsGridView.DataKeys[index].Values[1].ToString();
string url = "DependentForm.aspx?DependentId=" + DependentId + "&PerId=" + PerId;
string script = "window.open('" + url + "', 'popup_window1','width=700, height=700, left=50, top=100, resizable=yes');";
this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "script", script, true);
}
}
However when i tried opening the url
directly on my page it opened fine.