i have a hyperlink called companyname in gridview .when i click it has to open popup window and provides details of that company.can someone explain how to call popup window in hyperlink

Recommended Answers

All 5 Replies

in the target property of the field, set it to _blank

Hi... I would suggest passing the CompanyID in Session -- Session.Add("CompanyID") -- and retrieving the companyid -- Session.Item("ComanyID") from the popup.

Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GridView1.RowCommand

        If GridView1.Rows.Count - 1 > 0 Then

            If e.CommandName = "WHATEVERYOURBUTTONCOMMANDNAME" Then

 Dim CompanyID As String = GridView1.DataKeys(Convert.ToString(e.CommandArgument)).Item(0).ToString

Session.Add("CompanyID", CompanyID)

               Response.Write("<script>")
                Response.Write("window.open(YOURDETAILSWINDOW.aspx','_blank','toolbar=0,location=0,menubar=0,resizable=0,width=400,height=320')")
                Response.Write("</script>")

end if

end if

<asp:TemplateField HeaderText="Header">
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
<ItemTemplate>

<a onclick="javascript:window.open('PricePage.aspx?id=<%#DataBinder.Eval(Container.DataItem,"Columnname")%>&show=<%#DataBinder.Eval(Container.DataItem,"Columnname")%>');" href="#" id="a6" ><%#DataBinder.Eval(Container.DataItem, "Columnname")%></a>


</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Header">
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
<ItemTemplate>

<a onclick="javascript:window.open('PricePage.aspx?id=<%#DataBinder.Eval(Container.DataItem,"Columnname")%>&show=<%#DataBinder.Eval(Container.DataItem,"Columnname")%>');" href="#" id="a11" ><%#DataBinder.Eval(Container.DataItem, "Columnname")%></a>

</ItemTemplate>
</asp:TemplateField>
hi u can use this code and pass query string

Hi You can do that by using JavaScript's OpenWindow() method and set the attribute values properly so that you get what exactly you want..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.