Counting Clicks

Discussion in 'ASP .Net Datagrid Control' started by Bart, Jan 11, 2005.

  1. Bart

    Bart Guest

    Hi all,

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

    The grid contains a description field of a pdf document 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, Jan 11, 2005
    #1
    1. Advertising

  2. Bart

    Elton Wang Guest

    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 document

    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, Jan 11, 2005
    #2
    1. Advertising

  3. Bart

    Bart Guest

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

    rgds,

    Bart


    "Elton Wang" <> wrote in
    news:203101c4f820$a4403610$:

    > 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 document

    > 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, Jan 11, 2005
    #3
  4. Bart

    Bart Guest

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

    rgds,

    Bart


    "Elton Wang" <> wrote in
    news:203101c4f820$a4403610$:

    > 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 document

    > 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, Jan 11, 2005
    #4
  5. 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" <> wrote in message
    news:Xns95DBD3F234D3BNomailinternetcom@207.46.248.16...
    > Hi all,
    >
    > A customer of mine has an page with a datagridcontrol..
    >
    > The grid contains a description field of a pdf document 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], Jan 12, 2005
    #5
  6. Bart

    Elton Wang Guest

    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

    >-----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" <> wrote

    in
    >news:203101c4f820$a4403610$:
    >
    >> 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 document

    >> 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, Jan 12, 2005
    #6
  7. Bart

    Bart Guest

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


    "Elton Wang" <> wrote in
    news:052c01c4f8b2$ed255350$:

    > 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
    >
    >>-----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" <> wrote

    > in
    >>news:203101c4f820$a4403610$:
    >>
    >>> 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 document
    >>> 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, Jan 12, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    1
    Views:
    413
    Michael Pearson
    Oct 30, 2003
  2. Mannie
    Replies:
    7
    Views:
    726
    Harlan Messinger
    Mar 12, 2008
  3. PontiMax

    Clicks and double-clicks

    PontiMax, Jul 14, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    186
    Eliyahu Goldin
    Jul 14, 2004
  4. Keith

    Counting Clicks

    Keith, Feb 2, 2005, in forum: ASP General
    Replies:
    9
    Views:
    119
    Adrienne
    Feb 2, 2005
  5. edwardfredriks

    counting up instead of counting down

    edwardfredriks, Sep 6, 2005, in forum: Javascript
    Replies:
    6
    Views:
    207
    Dr John Stockton
    Sep 7, 2005
Loading...

Share This Page