Adding client-script to handle client events

Discussion in 'ASP .Net Datagrid Control' started by Andrea Williams, Apr 12, 2004.

  1. My code is in a search box pop-up that is opened by a parent page. From the
    search box, I need to be able to add code to a hyperlink in my datagrid (for
    each row) that will call a client-side script that accepts the ID (primary
    ID) and changes something in window.opener. I can add the javascript call
    like so:

    System.Web.UI.WebControls.HyperLinkColumn hypAddToSubmission = new
    HyperLinkColumn();

    hypAddToSubmission.DataNavigateUrlField = "ID");

    hypAddToSubmission.Text = "Add";

    hypAddToSubmission.NavigateUrl = "javascript:addAuthor(this);";

    this.dgdUsers.Columns.Add(hypAddToSubmission);


    Problem is, it doesn't get me the ID to utilize in the client script. I
    don't want my ID to be visible to the user, but I need to be able to get the
    ID so that I can pass it back to the parent page.

    Is there a way to tell the data grid to add the ID into my NavigateUrl?

    OR is there a way to add an <input type="hidden"> to a column to be utilized
    by the clients-side script?

    Any other ideas??

    Thanks in advance!
    Andrea
    Andrea Williams, Apr 12, 2004
    #1
    1. Advertising

  2. I found the answer... I guess I should have waited a bit longer to post...

    should anyone need to know besides me, look up "DataNavigateUrlFormatString"

    That worked quite nicely!

    Andrea



    "Andrea Williams" <> wrote in message
    news:...
    > My code is in a search box pop-up that is opened by a parent page. From

    the
    > search box, I need to be able to add code to a hyperlink in my datagrid

    (for
    > each row) that will call a client-side script that accepts the ID (primary
    > ID) and changes something in window.opener. I can add the javascript call
    > like so:
    >
    > System.Web.UI.WebControls.HyperLinkColumn hypAddToSubmission = new
    > HyperLinkColumn();
    >
    > hypAddToSubmission.DataNavigateUrlField = "ID");
    >
    > hypAddToSubmission.Text = "Add";
    >
    > hypAddToSubmission.NavigateUrl = "javascript:addAuthor(this);";
    >
    > this.dgdUsers.Columns.Add(hypAddToSubmission);
    >
    >
    > Problem is, it doesn't get me the ID to utilize in the client script. I
    > don't want my ID to be visible to the user, but I need to be able to get

    the
    > ID so that I can pass it back to the parent page.
    >
    > Is there a way to tell the data grid to add the ID into my NavigateUrl?
    >
    > OR is there a way to add an <input type="hidden"> to a column to be

    utilized
    > by the clients-side script?
    >
    > Any other ideas??
    >
    > Thanks in advance!
    > Andrea
    >
    >
    Andrea Williams, Apr 12, 2004
    #2
    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. =?Utf-8?B?UGl0Y2Fpcm5pYQ==?=

    Script Callback in ASP.Net 2.0 events to handle

    =?Utf-8?B?UGl0Y2Fpcm5pYQ==?=, May 25, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    555
    =?Utf-8?B?UGl0Y2Fpcm5pYQ==?=
    May 25, 2005
  2. SevDer
    Replies:
    2
    Views:
    1,275
    Walter Wang [MSFT]
    Nov 13, 2007
  3. Blair Taylor
    Replies:
    1
    Views:
    329
    Alvin Bruney
    Aug 7, 2003
  4. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    327
    Chris
    Aug 30, 2005
  5. Markus Ernst

    Handle events from central script

    Markus Ernst, Jun 23, 2005, in forum: Javascript
    Replies:
    6
    Views:
    100
    Markus Ernst
    Jun 27, 2005
Loading...

Share This Page