Hyperlink

Discussion in 'ASP .Net Datagrid Control' started by Karl-Heinz, Nov 24, 2003.

  1. Karl-Heinz

    Karl-Heinz Guest

    Hello,

    I'm using a link in a datagrid by the operand
    "DataNavigateUrlFormatString=". I assume that the link only can activate a
    new aspx-page. But the code and the datagrid definitions exist already in
    the calling (the 1st) page.

    My second datagrid, which already exists, should be activated by a link from
    a column of the 1st datagrid. The 2nd datagrid shows several topics, the 1st
    shows several articles of each topic. I want to be able to click on a topic
    and then all related articles should be displayed.

    This time I am able to show all topics and all articles. I used the
    hyperlink and a second aspx-file is invoked. It shows all articles of the
    selected topic correct, but the code is very similar to that of the 1st
    aspx-file which is able to show a full list of all articles. Isn't it
    possible to link to this article's display routine and then to identify the
    article's data to be displayed?

    Any idea? Can you help? Thanks and have several nice days.

    Karl-Heinz


    --

    Author and webmaster of:
    _________________________________________
    http://www.sharpmz.org
    http://www.angerbichl.de
    http://www.huber-bgl.de
    http://www.hotelbavaria.net
    http://www.Freies-Radio-Bochum.de (in work)
    http://www.web-design-discounter.de (in work)
    http://www.web-design-discounter.com (in work)

    ICQ# 133769328
    I am a member of the S.U.C. / UK
    ( S.U.C.: SHARP User Club http://sharpusersclub.org/ )
     
    Karl-Heinz, Nov 24, 2003
    #1
    1. Advertising

  2. Karl-Heinz

    Todd Guest

    Not sure if this will help answer your question or not, but here
    something that I did. I let the user select from a drop-down menu to
    select an option. Doing so passes their selection as an input
    parameter into a SQL stored procedure, which populates a dataset which
    I bind to a DataGrid. After the bind, I use the following code to
    create a hyperlink on an ID number for each row in the DataGrid:

    x=0
    While x < DataGrid.Items.Count
    dgResults.Items.Item(x).Cells(5).Text = System.String.Format("<a
    href=""Detail.aspx?ID=" &
    CStr(ds.Tables("Results1").Rows(x).Item("IDNum")) & " "" " & "
    target=""_blank"">" &
    CStr(ds.Tables("Results1").Rows(x).Item("IDNum")) & "</a>")
    x += 1
    end While

    The above snippet creates the following within the .text property of
    the (5) cell of each record within my Datagrid. Assuming that I had 3
    rows in my datagrid's results then the 5th cell's text property would
    contain:
    <a href="Details.aspx?ID=00001" target="_blank">00001</a>
    <a href="Details.aspx?ID=00002" target="_blank">00002</a>
    <a href="Details.aspx?ID=00003" target="_blank">00003</a>

    Using x as a counter and adding one to it each time thru the loop will
    cause it to iterate through each record within the entire DataGrid.
    Then, when the user clicks on the link to go to the next page, I have
    some code intercept the URL variable, and then use that as an input
    parameter into another SQL stored procedure. This produces another
    datasetset which I bind to a second datagrid to display to the screen.
    So, the first page (first datagrid) is used as a broad view of
    several options. The second page (second datagrid) uses the URL
    variable to show the details for one specific record.
     
    Todd, Nov 24, 2003
    #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. Ravindra

    Adding hyperlink to winforms datagrid

    Ravindra, Dec 13, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    600
    Ravindra
    Dec 13, 2005
  2. VB Programmer
    Replies:
    0
    Views:
    385
    VB Programmer
    Jun 30, 2003
  3. davetichenor
    Replies:
    1
    Views:
    844
    Eliyahu Goldin
    Oct 30, 2006
  4. Ken
    Replies:
    1
    Views:
    387
    Alvin Bruney
    Aug 16, 2003
  5. Dave
    Replies:
    0
    Views:
    957
Loading...

Share This Page