Click on sort link on a datagrid opens new window

Discussion in 'ASP .Net Datagrid Control' started by Raymond Lewallen, Apr 29, 2004.

  1. 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, Apr 29, 2004
    #1
    1. Advertising

  2. Check that link does not have
    target="something"

    George.

    "Raymond Lewallen" <> wrote in message
    news:%...
    > 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, Apr 29, 2004
    #2
    1. Advertising

  3. 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.DataGridSortCommandEventArgs) 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" <> wrote in message
    news:%...
    > Check that link does not have
    > target="something"
    >
    > George.
    >
    > "Raymond Lewallen" <> wrote in message
    > news:%...
    > > 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, Apr 29, 2004
    #3
  4. Unfortunately never worked with modal windows.
    Anyway your datagrid looks good.
    Check the form tag maybe "target" slipped in there.


    George.

    "Raymond Lewallen" <> wrote in message
    news:...
    > 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.DataGridSortCommandEventArgs) 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" <> wrote in message
    > news:%...
    > > Check that link does not have
    > > target="something"
    > >
    > > George.
    > >
    > > "Raymond Lewallen" <> wrote in

    message
    > > news:%...
    > > > 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, Apr 30, 2004
    #4
    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. robertm
    Replies:
    1
    Views:
    822
    Vidar Petursson
    Aug 11, 2003
  2. Raymond Lewallen

    Click on sort link on a datagrid opens new window

    Raymond Lewallen, Apr 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,084
    George Ter-Saakov
    Apr 30, 2004
  3. Vijay Kerji

    Window.Close Opens New Annoying Window

    Vijay Kerji, Dec 1, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,119
    Eliyahu Goldin
    Dec 1, 2004
  4. Replies:
    6
    Views:
    894
    cwdjrxyz
    Feb 11, 2006
  5. Blue®
    Replies:
    4
    Views:
    794
    Blue®
    Sep 27, 2003
Loading...

Share This Page