473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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
Nov 18 '05 #1
3 2107
Check that link does not have
target="something"

George.

"Raymond Lewallen" <Ra******************@nospam.faa.gov> wrote in message
news:%2****************@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

Nov 18 '05 #2
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" <no****@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Check that link does not have
target="something"

George.

"Raymond Lewallen" <Ra******************@nospam.faa.gov> wrote in message
news:%2****************@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


Nov 18 '05 #3
Unfortunately never worked with modal windows.
Anyway your datagrid looks good.
Check the form tag maybe "target" slipped in there.
George.

"Raymond Lewallen" <Ra******************@nospam.faa.gov> wrote in message
news:u2**************@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" <no****@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Check that link does not have
target="something"

George.

"Raymond Lewallen" <Ra******************@nospam.faa.gov> wrote in message
news:%2****************@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



Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JohnEGee | last post by:
Hello, all, and TIA for any help you can offer. I've searched the Internet for answers and have finally come here. I've created a page (several, actually) with a link that opens a pop-up...
4
by: - R | last post by:
Hello all. I'm new to .Net so please help me out. I have a application with several "Threads" running to observe various things. From time to time each thread need to add an log entry, which...
4
by: Steve B. | last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's reflect the contents of the grid cells. Sorting of columns (both thru VS and programmatically) work fine except, when the...
2
by: yatharth | last post by:
I am facing a problem ,the situation is like this. I have a home page named "Index.html" ,on which there is login link,when i click on the login link the login popup opens and user enter the...
4
by: Carlo Marchesoni | last post by:
I have a button that opens a new Window (some kind of search-window), which is fired using JavaScript (btnSearch.Attributes=".....";) Now I need to run some code behind code BEFORE this JavaScript...
3
by: Sameer | last post by:
I have a webpage that has a link button. This link button on click opens up a new page. This is what is happening: 1. Load the web page. 2. Click on the link. 3. Refresh the web-page. Result:...
1
by: settyv | last post by:
Hi, I need to open PDF document in new window when i click on linkbutton in datagrid.For that i have written code as below: But the problem with this code is that it opens the new window ,but...
2
by: wpollans | last post by:
Hello, I need to able to write JS that will click on a link with the middle mouse button - so that the link target will open in a new window or tab - using firefox. Or is there a better (more...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.