Click on sort link on a datagrid opens new window

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Click on sort link on a datagrid opens new window

    I have a modal dialog displaying a datagrid control. Click on the column
    header to sort the datagrid opens a new window with the following in the
    location:

    javascript:__doPostBack('dgDataGrid$_ctl1$_ctl1',' ')

    instead of actually posting back to the modal dialog and sorting the
    datagrid. ItemDataBound, ItemCommand events both work fine, only the
    SortCommand is producing this unwanted behavior.

    Looking for a cause and solution please.

    Thank you,

    Raymond Lewallen


    Raymond Lewallen Guest

  2. Similar Questions and Discussions

    1. content target link opens in a new window!!
      hi i'm designing this HTML website with dreamweaver 8, it's a frameset devided into 3 frames top frame(navigation) , left frame (ads) and...
    2. In web browser to view pdf, click link and it opens in same window
      Customers download pdf from a server into a web browser with multiply links in pdf. When you click the links I want it open in a new window so the...
    3. Datagrid Sort/Link Problem
      I designed a data grid for a results page for some product data. The specific data put in the data grid is based on criteria entered into an...
    4. Button click on Web Dialog opens its copy in new window
      I have an aspx page which I open using the following code fragment below. The modal web dialog has 2 buttons and whenever I click any of them, a new...
    5. Safari: option-click link in new window?
      This must be a dumb question, but I am stumped. The answer may have to do with the Tabs feature, which I have also not figured out. In my older...
  3. #2

    Default Re: Click on sort link on a datagrid opens new window

    Check that link does not have
    target="something"

    George.

    "Raymond Lewallen" <Raymond.CTR.Lewallen@nospam.faa.gov> wrote in message
    news:%23ECmiGhLEHA.3712@TK2MSFTNGP10.phx.gbl...
    > I have a modal dialog displaying a datagrid control. Click on the column
    > header to sort the datagrid opens a new window with the following in the
    > location:
    >
    > javascript:__doPostBack('dgDataGrid$_ctl1$_ctl1',' ')
    >
    > instead of actually posting back to the modal dialog and sorting the
    > datagrid. ItemDataBound, ItemCommand events both work fine, only the
    > SortCommand is producing this unwanted behavior.
    >
    > Looking for a cause and solution please.
    >
    > Thank you,
    >
    > Raymond Lewallen
    >
    >

    George Ter-Saakov Guest

  4. #3

    Default Re: Click on sort link on a datagrid opens new window

    I can't see the source because it is in a modal dialog window, but I'm doing
    nothing other than the normal. Keep in mind this works fine in a normal
    window, just doesn't work in a modal window.

    <asp:datagrid
    id="dgDataGrid"
    runat="server"
    CssClass="dbgrid"
    BorderColor="#3366CC"
    BorderWidth="1px"
    BackColor="White"
    BorderStyle="None"
    AllowPaging="False"
    Height="86px"
    Width="580"
    AutoGenerateColumns="False"
    AllowSorting="True"
    DataKeyField="ID">

    <SelectedItemStyle
    Font-Bold="True"
    ForeColor="#CCFF99"
    BackColor="#009999">
    </SelectedItemStyle>

    <ItemStyle
    ForeColor="#003399"
    BackColor="White">
    </ItemStyle>

    <HeaderStyle
    Font-Bold="True"
    ForeColor="#CCCCFF"
    BackColor="#003399">
    </HeaderStyle>

    <FooterStyle
    ForeColor="#003399"
    BackColor="#99CCCC">
    </FooterStyle>

    <Columns>
    <asp:buttonColumn
    ButtonType="LinkButton"
    HeaderText="Lnk"
    Visible="False"
    HeaderStyle-Width="10%">
    </asp:buttonColumn>

    <asp:BoundColumn
    DataField="Type"
    SortExpression="Type"
    ReadOnly="True"
    HeaderText="Type">
    </asp:BoundColumn>

    <asp:BoundColumn
    DataField="Description"
    SortExpression="Description"
    ReadOnly="True"
    HeaderText="Description">
    </asp:BoundColumn>
    </Columns>

    </asp:datagrid>

    In code behind I have the following sub

    Sub dgDataGridSortCommand(ByVal source As System.Object, ByVal e As
    System.Web.UI.WebControls.DataGridSortCommandEvent Args) Handles
    dgDataGrid.SortCommand
    viewstate.Add("sortfield", e.SortExpression)
    If viewstate("sortdirection") Is Nothing Then
    viewstate.Add("sortdirection", "ASC")
    Else
    If viewstate("sortdirection").ToString = "ASC" Then
    viewstate("sortdirection") = "DESC"
    ElseIf viewstate("sortdirection").ToString = "DESC" Then
    viewstate("sortdirection") = "ASC"
    End If

    End If

    GridBind(e.SortExpression)
    dgDataGrid.SelectedIndex = -1
    End Sub

    "George Ter-Saakov" <nospam@hotmail.com> wrote in message
    news:%23K5tLHjLEHA.268@TK2MSFTNGP11.phx.gbl...
    > Check that link does not have
    > target="something"
    >
    > George.
    >
    > "Raymond Lewallen" <Raymond.CTR.Lewallen@nospam.faa.gov> wrote in message
    > news:%23ECmiGhLEHA.3712@TK2MSFTNGP10.phx.gbl...
    > > I have a modal dialog displaying a datagrid control. Click on the
    column
    > > header to sort the datagrid opens a new window with the following in the
    > > location:
    > >
    > > javascript:__doPostBack('dgDataGrid$_ctl1$_ctl1',' ')
    > >
    > > instead of actually posting back to the modal dialog and sorting the
    > > datagrid. ItemDataBound, ItemCommand events both work fine, only the
    > > SortCommand is producing this unwanted behavior.
    > >
    > > Looking for a cause and solution please.
    > >
    > > Thank you,
    > >
    > > Raymond Lewallen
    > >
    > >
    >
    >

    Raymond Lewallen Guest

  5. #4

    Default Re: Click on sort link on a datagrid opens new window

    Unfortunately never worked with modal windows.
    Anyway your datagrid looks good.
    Check the form tag maybe "target" slipped in there.


    George.

    "Raymond Lewallen" <Raymond.CTR.Lewallen@nospam.faa.gov> wrote in message
    news:u249hRjLEHA.3324@TK2MSFTNGP10.phx.gbl...
    > I can't see the source because it is in a modal dialog window, but I'm
    doing
    > nothing other than the normal. Keep in mind this works fine in a normal
    > window, just doesn't work in a modal window.
    >
    > <asp:datagrid
    > id="dgDataGrid"
    > runat="server"
    > CssClass="dbgrid"
    > BorderColor="#3366CC"
    > BorderWidth="1px"
    > BackColor="White"
    > BorderStyle="None"
    > AllowPaging="False"
    > Height="86px"
    > Width="580"
    > AutoGenerateColumns="False"
    > AllowSorting="True"
    > DataKeyField="ID">
    >
    > <SelectedItemStyle
    > Font-Bold="True"
    > ForeColor="#CCFF99"
    > BackColor="#009999">
    > </SelectedItemStyle>
    >
    > <ItemStyle
    > ForeColor="#003399"
    > BackColor="White">
    > </ItemStyle>
    >
    > <HeaderStyle
    > Font-Bold="True"
    > ForeColor="#CCCCFF"
    > BackColor="#003399">
    > </HeaderStyle>
    >
    > <FooterStyle
    > ForeColor="#003399"
    > BackColor="#99CCCC">
    > </FooterStyle>
    >
    > <Columns>
    > <asp:buttonColumn
    > ButtonType="LinkButton"
    > HeaderText="Lnk"
    > Visible="False"
    > HeaderStyle-Width="10%">
    > </asp:buttonColumn>
    >
    > <asp:BoundColumn
    > DataField="Type"
    > SortExpression="Type"
    > ReadOnly="True"
    > HeaderText="Type">
    > </asp:BoundColumn>
    >
    > <asp:BoundColumn
    > DataField="Description"
    > SortExpression="Description"
    > ReadOnly="True"
    > HeaderText="Description">
    > </asp:BoundColumn>
    > </Columns>
    >
    > </asp:datagrid>
    >
    > In code behind I have the following sub
    >
    > Sub dgDataGridSortCommand(ByVal source As System.Object, ByVal e As
    > System.Web.UI.WebControls.DataGridSortCommandEvent Args) Handles
    > dgDataGrid.SortCommand
    > viewstate.Add("sortfield", e.SortExpression)
    > If viewstate("sortdirection") Is Nothing Then
    > viewstate.Add("sortdirection", "ASC")
    > Else
    > If viewstate("sortdirection").ToString = "ASC" Then
    > viewstate("sortdirection") = "DESC"
    > ElseIf viewstate("sortdirection").ToString = "DESC" Then
    > viewstate("sortdirection") = "ASC"
    > End If
    >
    > End If
    >
    > GridBind(e.SortExpression)
    > dgDataGrid.SelectedIndex = -1
    > End Sub
    >
    > "George Ter-Saakov" <nospam@hotmail.com> wrote in message
    > news:%23K5tLHjLEHA.268@TK2MSFTNGP11.phx.gbl...
    > > Check that link does not have
    > > target="something"
    > >
    > > George.
    > >
    > > "Raymond Lewallen" <Raymond.CTR.Lewallen@nospam.faa.gov> wrote in
    message
    > > news:%23ECmiGhLEHA.3712@TK2MSFTNGP10.phx.gbl...
    > > > I have a modal dialog displaying a datagrid control. Click on the
    > column
    > > > header to sort the datagrid opens a new window with the following in
    the
    > > > location:
    > > >
    > > > javascript:__doPostBack('dgDataGrid$_ctl1$_ctl1',' ')
    > > >
    > > > instead of actually posting back to the modal dialog and sorting the
    > > > datagrid. ItemDataBound, ItemCommand events both work fine, only the
    > > > SortCommand is producing this unwanted behavior.
    > > >
    > > > Looking for a cause and solution please.
    > > >
    > > > Thank you,
    > > >
    > > > Raymond Lewallen
    > > >
    > > >
    > >
    > >
    >
    >

    George Ter-Saakov Guest

  6. #5

    Default Click on sort link on a datagrid opens new window

    write the following line in the head tag
    <base target="_self" />

    I have a modal dialog displaying a datagrid control. Click on the column
    header to sort the datagrid opens a new window with the following in the
    location:

    javascript:__doPostBack('dgDataGrid$_ctl1$_ctl1',' ')

    instead of actually posting back to the modal dialog and sorting the
    datagrid. ItemDataBound, ItemCommand events both work fine, only the
    SortCommand is producing this unwanted behavior.

    Looking for a cause and solution please.

    Thank you.
    Unregistered Guest

Posting Permissions

  • You may not post new threads
  • You may 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