Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / Redirect to a different page when a row is selected

Redirect to a different page when a row is selected

New Discussion
Angela Gunderson
Angela Gunderson asked on Apr 9, 2013 8:12 PM

I would like the grid to work in a way so that the user clicks on a row and the row is selected and then I need to redirect to another page based on which row the user selects. In example: if there are three columns, Member ID, Member Name and DOB and the Member ID is the DataKeyField. When the user clicks on a row, I want to redirect to another page…but I’m sending the value of the Member ID field as a querystring when redirecting to the other page. Any suggestions?

Using the UltraWebGrid, I used to accomplish this in the Click event with the following code…but I can’t get it to work using the WebDataGrid:

Protected
Sub grid_Click(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.ClickEventArgs) Handles grid.Click
Response.Redirect(“Summary.aspx?Member_ID=” & e.Row.Cells.FromKey(“Member_ID”).Value)
End
Sub

Sign In to post a reply

Replies

  • 0
    [Infragistics] Nikolay
    [Infragistics] Nikolay answered on Jun 15, 2012 11:37 AM

    Hi algunderson,

    To accomplish this, I would suggest to enable the Selection behavior, set CellClickAction=”Row” and RowSelectType=”Single”, then handle the RowSelectionChanged event:

     

    Protected Sub WebDataGrid1_RowSelectionChanged(sender As Object, e As Infragistics.Web.UI.GridControls.SelectedRowEventArgs)
       Response.Redirect("Summary.aspx?Member_ID=" + e.CurrentSelectedRows(0).Items.FindItemByKey("Member_ID").Value.ToString())
    End Sub

    Also, you should set AutoPostBackFlags RowSelectionChanged to true.

     

    Let me know if this helps.

    • 0
      Angela Gunderson
      Angela Gunderson answered on Jun 15, 2012 3:09 PM

      The code you suggested works…but when the next page opens up, the path/URL still says it's on the initial page. The page I start out on is "Members.aspx?Member_ID=All". When I select member 12345678, I want the "Summary.aspx?Member_ID=12345678" to open…and while it appears the page opens, the path/URL still says "Members.aspx?Member_ID=All". Since I use the value of the querystring on the page that opens, I really need it to have the redirected URL along with the querystring.

      Any suggestions?

       

      • 0
        [Infragistics] Nikolay
        [Infragistics] Nikolay answered on Jun 20, 2012 2:25 PM

        Hi algunderson,

        I would suggest that you disable AJAX for the grid. Setting EnableAjax="false"  should resolve this issue.

        Let me know if this helps.

      • 0
        Angela Gunderson
        Angela Gunderson answered on Jun 21, 2012 2:54 PM

        Works like a charm!

        Thank you so much.

      • 0
        [Infragistics] Nikolay
        [Infragistics] Nikolay answered on Jun 21, 2012 3:05 PM

        Hello algunderson,

        I'm glad I could help.

        Let me know if you have any other questions.

      • 0
        Angela Gunderson
        Angela Gunderson answered on Jun 21, 2012 3:19 PM

        While it does still work like a charm…the page is refreshing if I click on the filter row. Is there any way to stop this from happening?

      • 0
        [Infragistics] Nikolay
        [Infragistics] Nikolay answered on Jun 22, 2012 9:47 AM

        Hi algunderson,

        It seems that this is not possible since you are using Response.Redirect and changing the url.

      • 0
        Angela Gunderson
        Angela Gunderson answered on Jun 22, 2012 2:21 PM

        When I click on one of the rows, it does redirect to the new page…but when I click on the filter row, the current page refreshes.

        My code to redirect to the new page is in the RowSelectionChanged piece. Should it be used in some other action so that when the user clicks on the filter row to put in a filter the page doesn't refresh prior to the user typing anything into the filter?

      • 0
        [Infragistics] Nikolay
        [Infragistics] Nikolay answered on Jun 22, 2012 3:29 PM

        Hi algunderson,

        Clicking on the filter row should not trigger RowSelectionChanged event and do a postback. Can you provide me with a sample, demonstrating this behavior, as I am so far unable to reproduce it.

        Thanks.

      • 0
        Angela Gunderson
        Angela Gunderson answered on Jun 22, 2012 5:40 PM

        I figured it out. It was happening because I had marked the ActiveCellChanged flag to True in the WebDataGrid Designer under the Activation>AutoPostBackFlags section. As soon as I marked it back to False (it defaults to False), it no longer refreshes the page when the filter row is selected/clicked.

        Thank you for all your help!

      • 0
        [Infragistics] Nikolay
        [Infragistics] Nikolay answered on Jun 25, 2012 6:29 AM

        Hello algunderson,

        I'm glad to hear that. If you have any other questions, please let me know.

      • 0
        Neil
        Neil answered on Apr 9, 2013 7:37 PM

        Does this mean it is not possible to have an Ajax enabled WebDataGrid that can redirect to a different page after a Row is selected?

      • 0
        Neil
        Neil answered on Apr 9, 2013 8:12 PM

        Never mind. I found a workaround that allows me to keep ajax enabled and redirect to a different page on row selection changed.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Angela Gunderson
Favorites
0
Replies
14
Created On
Apr 09, 2013
Last Post
12 years, 10 months ago

Suggested Discussions

Created by

Created on

Apr 9, 2013 8:12 PM

Last activity on

Feb 25, 2026 9:04 AM