B
Bart Schelkens
Sorry but I have another question about a button in a datagrid.
I have the following button in my datagrid :
asp:TemplateColumn HeaderText="">
<HeaderStyle width="20px"></HeaderStyle>
<ItemTemplate>
<asp:Button id="btnSubCategory" Text="Sub-Categorie" runat="server"
CommandArgument='<%# DataBinder.Eval(Container.DataItem,"CategoryID") %>'>
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
This next part is to open a link whenever that button is clicked. The GetUrl
returns the URL of the page that needs to be opened.
Private Sub dtgCategories_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dtgCategories.ItemCommand
Dim lstrScript As New System.Text.StringBuilder()
With lstrScript
.Append("<script language=""javascript"">")
.Append("var NewWindow = window.open('" &
GetUrl(e.CommandArgument) & "')")
.Append("</script>")
End With
Page.RegisterStartupScript("SubCategory", lstrScript.ToString)
End Sub
It works fine, except for a small problem.
It opens the link in a new window. Apparently due to the line "var NewWindow
= window.open"
As my site is built-up of 3 frames, I would like to display that link into
my "mainFrame".
How can I do this?
Thx
I have the following button in my datagrid :
asp:TemplateColumn HeaderText="">
<HeaderStyle width="20px"></HeaderStyle>
<ItemTemplate>
<asp:Button id="btnSubCategory" Text="Sub-Categorie" runat="server"
CommandArgument='<%# DataBinder.Eval(Container.DataItem,"CategoryID") %>'>
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
This next part is to open a link whenever that button is clicked. The GetUrl
returns the URL of the page that needs to be opened.
Private Sub dtgCategories_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dtgCategories.ItemCommand
Dim lstrScript As New System.Text.StringBuilder()
With lstrScript
.Append("<script language=""javascript"">")
.Append("var NewWindow = window.open('" &
GetUrl(e.CommandArgument) & "')")
.Append("</script>")
End With
Page.RegisterStartupScript("SubCategory", lstrScript.ToString)
End Sub
It works fine, except for a small problem.
It opens the link in a new window. Apparently due to the line "var NewWindow
= window.open"
As my site is built-up of 3 frames, I would like to display that link into
my "mainFrame".
How can I do this?
Thx