Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to open a pop up window on clicking hyperlinkfield inside gridview

How to open a pop up window on clicking hyperlinkfield inside gridview

Scheduled Pinned Locked Moved ASP.NET
tutorialquestioncareer
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mithun narayanan
    wrote on last edited by
    #1

    How to open a pop up window on clicking hyperlinkfield inside gridview,also i have to pass to querystrings to the second page. <asp:HyperLinkField HeaderText="View Resume" Text="View" Target="_blank" DataNavigateUrlFields="cand_id,rrf_id" DataNavigateUrlFormatString="ResumeDetails.aspx?cand_id={0}&rrf_id={1}" > </asp:HyperLinkField> thnx for ny reply.. MiThuN NaRaYaNaN

    N P 2 Replies Last reply
    0
    • M mithun narayanan

      How to open a pop up window on clicking hyperlinkfield inside gridview,also i have to pass to querystrings to the second page. <asp:HyperLinkField HeaderText="View Resume" Text="View" Target="_blank" DataNavigateUrlFields="cand_id,rrf_id" DataNavigateUrlFormatString="ResumeDetails.aspx?cand_id={0}&rrf_id={1}" > </asp:HyperLinkField> thnx for ny reply.. MiThuN NaRaYaNaN

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      mithun narayanan wrote:

      How to open a pop up window on clicking hyperlinkfield inside gridview

      On RowDataBound event of gridview, find the hyperlink button and add Onclick attributes there.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      M 1 Reply Last reply
      0
      • N N a v a n e e t h

        mithun narayanan wrote:

        How to open a pop up window on clicking hyperlinkfield inside gridview

        On RowDataBound event of gridview, find the hyperlink button and add Onclick attributes there.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

        M Offline
        M Offline
        mithun narayanan
        wrote on last edited by
        #3

        thanx navaneeth.... But still prblm.. i have already tried with row command,but its not entering inside this function i tried putting break points.also thers no command name for hyperlink fields.also ia am not using hperlink buttons am using hyperlink field Mithun Narayanan

        modified on Tuesday, December 18, 2007 6:39:43 AM

        N 1 Reply Last reply
        0
        • M mithun narayanan

          How to open a pop up window on clicking hyperlinkfield inside gridview,also i have to pass to querystrings to the second page. <asp:HyperLinkField HeaderText="View Resume" Text="View" Target="_blank" DataNavigateUrlFields="cand_id,rrf_id" DataNavigateUrlFormatString="ResumeDetails.aspx?cand_id={0}&rrf_id={1}" > </asp:HyperLinkField> thnx for ny reply.. MiThuN NaRaYaNaN

          P Offline
          P Offline
          Pankaj Chamria
          wrote on last edited by
          #4

          First you need an Itemplate in the GridView with Hyperlink as one of the required columns. I think you already have that. Then implement the row data bound event as below: protected void GridView_RowDataBound ( object sender, GridViewRowEventArgs e ) { LinkButton lnkBut = new LinkButton(); HyperLink hlnk = new HyperLink(); if ( (ListItemType)e.Row.RowType == ListItemType.Item || (ListItemType)e.Row.RowType == ListItemType.AlternatingItem ) { hlnk = (HyperLink)( e.Row.FindControl("HyperLink1") ); string strPathFromDB = hlnk.Text; //NOTE: OR this can be a predetermined path hard-coded here if you wish to have the same path for all rows. You can add your query string after the path. hlnk.NavigateUrl = String.Format("{0}", strPathFromDB.Replace("\\", "/")); hlnk.Target = "_blank"; ALTERNATE WAY: Attach javascript to Hyperlink. url = "DocumentLinkControl.aspx?TradeDate=" + tradeDate + "&CounterParty=" + counterParty lnkBut.Attributes.Add("onclick", "window.open('" + url + "',null,'left=400, top=50, height=800, width= 650, status=no, resizable= no, scrollbars= yes, toolbar= no,location= no, menubar= no');"); } } Let me know if this didnt work..

          Pankaj Chamria, Software Programmer.

          M 1 Reply Last reply
          0
          • M mithun narayanan

            thanx navaneeth.... But still prblm.. i have already tried with row command,but its not entering inside this function i tried putting break points.also thers no command name for hyperlink fields.also ia am not using hperlink buttons am using hyperlink field Mithun Narayanan

            modified on Tuesday, December 18, 2007 6:39:43 AM

            N Offline
            N Offline
            N a v a n e e t h
            wrote on last edited by
            #5

            mithun narayanan wrote:

            ia am not using hperlink buttons am using hyperlink field

            Have you tried in Control collection ?

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

            M 1 Reply Last reply
            0
            • N N a v a n e e t h

              mithun narayanan wrote:

              ia am not using hperlink buttons am using hyperlink field

              Have you tried in Control collection ?

              All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

              M Offline
              M Offline
              mithun narayanan
              wrote on last edited by
              #6

              thnks Navneeth,that still not workd., i ve found alternate way for that <asp:TemplateField HeaderText="View Resume"> <ItemTemplate> <asp:Hyperlink Text="View" ID="Hyperlink2" NavigateUrl=<%#"javascript:my_window=window.open('ResumeDetails.aspx?cand_id=" + DataBinder.Eval(Container.DataItem,"cand_id").ToString() + "&rrf_id=" + DataBinder.Eval(Container.DataItem,"rrf_id").ToString() + "','my_window','toolbar=no, location=no, titlebar=no, linkbar=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=800, height=600, copyhistory=no');my_window.focus()" %> Runat="Server"> </asp:Hyperlink> </ItemTemplate> <ItemStyle HorizontalAlign="Center" /> </asp:TemplateField>

              1 Reply Last reply
              0
              • P Pankaj Chamria

                First you need an Itemplate in the GridView with Hyperlink as one of the required columns. I think you already have that. Then implement the row data bound event as below: protected void GridView_RowDataBound ( object sender, GridViewRowEventArgs e ) { LinkButton lnkBut = new LinkButton(); HyperLink hlnk = new HyperLink(); if ( (ListItemType)e.Row.RowType == ListItemType.Item || (ListItemType)e.Row.RowType == ListItemType.AlternatingItem ) { hlnk = (HyperLink)( e.Row.FindControl("HyperLink1") ); string strPathFromDB = hlnk.Text; //NOTE: OR this can be a predetermined path hard-coded here if you wish to have the same path for all rows. You can add your query string after the path. hlnk.NavigateUrl = String.Format("{0}", strPathFromDB.Replace("\\", "/")); hlnk.Target = "_blank"; ALTERNATE WAY: Attach javascript to Hyperlink. url = "DocumentLinkControl.aspx?TradeDate=" + tradeDate + "&CounterParty=" + counterParty lnkBut.Attributes.Add("onclick", "window.open('" + url + "',null,'left=400, top=50, height=800, width= 650, status=no, resizable= no, scrollbars= yes, toolbar= no,location= no, menubar= no');"); } } Let me know if this didnt work..

                Pankaj Chamria, Software Programmer.

                M Offline
                M Offline
                mithun narayanan
                wrote on last edited by
                #7

                thnks Pankaj,that still not workd., i ve found alternate way for that <asp:TemplateField HeaderText="View Resume"> <ItemTemplate> <asp:Hyperlink Text="View" ID="Hyperlink2" NavigateUrl=<%#"javascript:my_window=window.open('ResumeDetails.aspx?cand_id=" + DataBinder.Eval(Container.DataItem,"cand_id").ToString() + "&rrf_id=" + DataBinder.Eval(Container.DataItem,"rrf_id").ToString() + "','my_window','toolbar=no, location=no, titlebar=no, linkbar=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=800, height=600, copyhistory=no');my_window.focus()" %> Runat="Server"> </asp:Hyperlink> </ItemTemplate> <ItemStyle HorizontalAlign="Center" /> </asp:TemplateField>

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups