Live Chat Icon For mobile
Live Chat Icon

How to open a new window with multiple parameters when clicked on a hyperlink in a column in a datagrid

Platform: ASP.NET| Category: DataGrid

The column should be defined as a TemplateColumn as follows and the NavigateUrl for that hyperlink can be set as follows to open a new window with parameters varying based on the row in which the hyperlink is present.


<asp:TemplateColumn >
<ItemTemplate>
<asp:Hyperlink ID='Hyperlink2' Runat='Server' 
NavigateUrl= <%#'javascript:my_window=window.open(’webform2.aspx?id=' + DataBinder.Eval(Container.DataItem,'productid').ToString() + '&Supplierid=' + DataBinder.Eval(Container.DataItem,'SupplierID').ToString() + '’,’my_window’,’width=300,height=300’);my_window.focus()' %> 
text=<%#DataBinder.Eval(Container.DataItem,'ProductName').ToString() %>> 
</asp:Hyperlink> 
</ItemTemplate> 
</asp:TemplateColumn>

The above approach would avoid the problem of showing the screen of [Object] on the parent page

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.