Professional Web Applications Themes

Counting Clicks - ASP.NET Data Grid Control

Hi all, A customer of mine has an page with a datagridcontrol.. The grid contains a description field of a pdf doent and a HyperlinkColumn to the actual pdf file..(the location is read from a database) Now my client asks if its possible to count how many times a pdf is displayed in other words every time a user clicks a link a counter has be updates. Can I link a command to a hyperLinkColumn wich fire's a function I created?? thks, Bart...

  1. #1

    Default Counting Clicks

    Hi all,

    A customer of mine has an page with a datagridcontrol..

    The grid contains a description field of a pdf doent and a
    HyperlinkColumn to the actual pdf file..(the location is read from a
    database)

    Now my client asks if its possible to count how many times a pdf is
    displayed in other words every time a user clicks a link a counter has be
    updates. Can I link a command to a hyperLinkColumn wich fire's a function I
    created??

    thks,

    Bart

    Bart Guest

  2. #2

    Default Counting Clicks

    Hi Bart,

    Currently, when HyperlinkColumn is clicked, what do you
    do, directly shows pdf file or some thing else?

    Elton Wang
    >-----Original Message-----
    >Hi all,
    >
    >A customer of mine has an page with a datagridcontrol..
    >
    >The grid contains a description field of a pdf doent
    and a
    >HyperlinkColumn to the actual pdf file..(the location is
    read from a
    >database)
    >
    >Now my client asks if its possible to count how many
    times a pdf is
    >displayed in other words every time a user clicks a link
    a counter has be
    >updates. Can I link a command to a hyperLinkColumn wich
    fire's a function I
    >created??
    >
    >thks,
    >
    >Bart
    >
    >.
    >
    Elton Wang Guest

  3. #3

    Default Re: Counting Clicks

    I directly show the PDF file thru the DataNavigateUrlField field wich is
    bound to a field in the DB

    rgds,

    Bart


    "Elton Wang" <anonymousdiscussions.microsoft.com> wrote in
    news:203101c4f820$a4403610$a301280aphx.gbl:
    > Hi Bart,
    >
    > Currently, when HyperlinkColumn is clicked, what do you
    > do, directly shows pdf file or some thing else?
    >
    > Elton Wang
    >
    >>-----Original Message-----
    >>Hi all,
    >>
    >>A customer of mine has an page with a datagridcontrol..
    >>
    >>The grid contains a description field of a pdf doent
    > and a
    >>HyperlinkColumn to the actual pdf file..(the location is
    > read from a
    >>database)
    >>
    >>Now my client asks if its possible to count how many
    > times a pdf is
    >>displayed in other words every time a user clicks a link
    > a counter has be
    >>updates. Can I link a command to a hyperLinkColumn wich
    > fire's a function I
    >>created??
    >>
    >>thks,
    >>
    >>Bart
    >>
    >>.
    >>
    >
    Bart Guest

  4. #4

    Default Re: Counting Clicks

    I directly show the PDF file thru the DataNavigateUrlField field wich is
    bound to a field in the DB

    rgds,

    Bart


    "Elton Wang" <anonymousdiscussions.microsoft.com> wrote in
    news:203101c4f820$a4403610$a301280aphx.gbl:
    > Hi Bart,
    >
    > Currently, when HyperlinkColumn is clicked, what do you
    > do, directly shows pdf file or some thing else?
    >
    > Elton Wang
    >
    >>-----Original Message-----
    >>Hi all,
    >>
    >>A customer of mine has an page with a datagridcontrol..
    >>
    >>The grid contains a description field of a pdf doent
    > and a
    >>HyperlinkColumn to the actual pdf file..(the location is
    > read from a
    >>database)
    >>
    >>Now my client asks if its possible to count how many
    > times a pdf is
    >>displayed in other words every time a user clicks a link
    > a counter has be
    >>updates. Can I link a command to a hyperLinkColumn wich
    > fire's a function I
    >>created??
    >>
    >>thks,
    >>
    >>Bart
    >>
    >>.
    >>
    >
    Bart Guest

  5. #5

    Default Re: Counting Clicks

    What about using a Linkbutton so you can bump the counter during its click
    event?

    Private Sub Page_Load _
    (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
    MyBase.Load
    If Not IsNothing(Application("clicks")) Then
    Label1.Text = "Clicks=" & Application("clicks").ToString
    End If
    End Sub

    Private Sub LinkButton1_Click _
    (ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles LinkButton1.Click
    Application.Lock()
    Application("clicks") = Application("clicks") + 1
    Application.UnLock()
    Response.ContentType = "application/PDF"
    Response.AppendHeader("content-disposition", _
    "attachment:filename=test.pdf")
    Response.WriteFile(Server.MapPath("MiniReader.pdf" ))
    End Sub

    <form id="Form1" method="post" runat="server">
    <p>
    <asp:linkbutton id="LinkButton1"
    runat="server">LinkButton</asp:linkbutton></p>
    <p>
    <asp:label id="Label1" runat="server"></asp:label></p>
    </form>

    Ken
    Microsoft MVP [ASP.NET]
    Toronto

    "Bart" <Nomailinternet.com> wrote in message
    news:Xns95DBD3F234D3BNomailinternetcom207.46.248. 16...
    > Hi all,
    >
    > A customer of mine has an page with a datagridcontrol..
    >
    > The grid contains a description field of a pdf doent and a
    > HyperlinkColumn to the actual pdf file..(the location is read from a
    > database)
    >
    > Now my client asks if its possible to count how many times a pdf is
    > displayed in other words every time a user clicks a link a counter has be
    > updates. Can I link a command to a hyperLinkColumn wich fire's a function
    > I
    > created??
    >
    > thks,
    >
    > Bart
    >
    Ken Cox [Microsoft MVP] Guest

  6. #6

    Default Re: Counting Clicks

    Hi Bart,

    Another way is to build a new page, e.g. pdf.aspx. And
    change datagrid DataNavigateUrl Field from pdfUrl
    to "pdf.aspx?url=" + pdfUrl.

    In pdf.aspx Page_Load, using following code:

    if (this.Request.QueryString.Get("Url") != null)
    {
    string url = Request.QueryString.Get("Url");
    if (!url.Equals(""))
    {
    // count click
    this.Response.Redirect(url);
    }
    }

    Elton Wang
    [email]elton_wanghotmail.com[/email]
    >-----Original Message-----
    >I directly show the PDF file thru the
    DataNavigateUrlField field wich is
    >bound to a field in the DB
    >
    >rgds,
    >
    >Bart
    >
    >
    >"Elton Wang" <anonymousdiscussions.microsoft.com> wrote
    in
    >news:203101c4f820$a4403610$a301280aphx.gbl:
    >
    >> Hi Bart,
    >>
    >> Currently, when HyperlinkColumn is clicked, what do you
    >> do, directly shows pdf file or some thing else?
    >>
    >> Elton Wang
    >>
    >>>-----Original Message-----
    >>>Hi all,
    >>>
    >>>A customer of mine has an page with a datagridcontrol..
    >>>
    >>>The grid contains a description field of a pdf doent
    >> and a
    >>>HyperlinkColumn to the actual pdf file..(the location
    is
    >> read from a
    >>>database)
    >>>
    >>>Now my client asks if its possible to count how many
    >> times a pdf is
    >>>displayed in other words every time a user clicks a
    link
    >> a counter has be
    >>>updates. Can I link a command to a hyperLinkColumn wich
    >> fire's a function I
    >>>created??
    >>>
    >>>thks,
    >>>
    >>>Bart
    >>>
    >>>.
    >>>
    >>
    >
    >.
    >
    Elton Wang Guest

  7. #7

    Default Re: Counting Clicks

    that's a great idea.. I'll give that a try


    "Elton Wang" <eltondiscussions.microsoft.com> wrote in
    news:052c01c4f8b2$ed255350$a401280aphx.gbl:
    > Hi Bart,
    >
    > Another way is to build a new page, e.g. pdf.aspx. And
    > change datagrid DataNavigateUrl Field from pdfUrl
    > to "pdf.aspx?url=" + pdfUrl.
    >
    > In pdf.aspx Page_Load, using following code:
    >
    > if (this.Request.QueryString.Get("Url") != null)
    > {
    > string url = Request.QueryString.Get("Url");
    > if (!url.Equals(""))
    > {
    > // count click
    > this.Response.Redirect(url);
    > }
    > }
    >
    > Elton Wang
    > [email]elton_wanghotmail.com[/email]
    >>-----Original Message-----
    >>I directly show the PDF file thru the
    > DataNavigateUrlField field wich is
    >>bound to a field in the DB
    >>
    >>rgds,
    >>
    >>Bart
    >>
    >>
    >>"Elton Wang" <anonymousdiscussions.microsoft.com> wrote
    > in
    >>news:203101c4f820$a4403610$a301280aphx.gbl:
    >>
    >>> Hi Bart,
    >>>
    >>> Currently, when HyperlinkColumn is clicked, what do you
    >>> do, directly shows pdf file or some thing else?
    >>>
    >>> Elton Wang
    >>>
    >>>>-----Original Message-----
    >>>>Hi all,
    >>>>
    >>>>A customer of mine has an page with a datagridcontrol..
    >>>>
    >>>>The grid contains a description field of a pdf doent
    >>> and a
    >>>>HyperlinkColumn to the actual pdf file..(the location
    > is
    >>> read from a
    >>>>database)
    >>>>
    >>>>Now my client asks if its possible to count how many
    >>> times a pdf is
    >>>>displayed in other words every time a user clicks a
    > link
    >>> a counter has be
    >>>>updates. Can I link a command to a hyperLinkColumn wich
    >>> fire's a function I
    >>>>created??
    >>>>
    >>>>thks,
    >>>>
    >>>>Bart
    >>>>
    >>>>.
    >>>>
    >>>
    >>
    >>.
    >>
    >
    Bart Guest

Similar Threads

  1. Clicks and double-clicks
    By PontiMax in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: July 14th, 11:00 AM
  2. Images with clicks
    By Nrgo in forum Macromedia Director Basics
    Replies: 2
    Last Post: April 29th, 08:11 AM
  3. Button is requiring several clicks to work ?
    By julmc in forum Macromedia Flash Actionscript
    Replies: 2
    Last Post: February 16th, 12:15 PM
  4. multiple mouse clicks
    By mrsr84 in forum Macromedia Director Lingo
    Replies: 6
    Last Post: September 1st, 07:19 PM
  5. [Q] Metal window - no updates, no clicks
    By Peter Amberg in forum Mac Programming
    Replies: 2
    Last Post: August 4th, 04:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139