473,466 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

can't get this code to work

Hi,

WebPage Description:

Contains one datagrid with link button column and one gridview with
dropdownlist column.
<asp:LinkButton id="QueryName" runat="server" autopostback="true"
onclick="onclick"></asp:LinkButton>

<asp:DropDownList id="GroupQueries" runat="server" width = "150px"
autopostback="true"
onselectedindexchanged="OnSelectedIndexChanged"></asp:DropDownList>

A click on a linkbutton creates an instance of a Query object (that's
one of my classes), stores it in a Session variable and redirects to
Flow.aspx (all of this is actually done in RowCommand) and I'm using
the OnClick event for debugging purpose.

A selection in the dropdownlist do the same thing (see
OnSelectedIndexChange event)

How to reproduce issue:

click on a hyperlink -> postback, RowCommand, redirection to Flow.aspx
click on back button of browser
selection of a value in a dropdownlist -> postback,
OnSelectedIndexChanged, redirection to Flow.aspx
click on back button of browser
click on a hyperlink -> postback, OnSelectedIndexChanged, redirection
to Flow.aspx
As you can see something goes seriously wrong at one point.

Could you help me with this please, I'm struggling to figure out what's
wrong ?
Here is the code:

Public Sub OnSelectedIndexChanged(ByVal sender As Object, ByVal e As
EventArgs)
If CType(sender, DropDownList).SelectedItem.Value.ToString <> " "
Then
Dim q As New Query(CType(sender, DropDownList).SelectedItem.Text,
CInt(CType (sender,DropDownList).SelectedItem.Value))

Session("CurrentQuery") = q
Response.Redirect("Flow.aspx")
End If
End Sub

Public Sub onclick(ByVal sender As Object, ByVal e As EventArgs)
Stop
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Not IsPostBack Then
lblWebName.Text = Session("WebName").ToString
lblUserName.Text = Me.User.Identity.Name
If Cache("dsQueries") Is Nothing Then
GetQueries()
Else
BindGrid1(Cache("dsQueries").tables("SingleQueries "))
BindGrid2(Cache("dsQueries").tables("Groups"),
Cache("dsQueries").Tables("GroupQueries"))
End If
End If
End Sub

Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs ) Handles
GridView1.RowCommand

Dim QueryName As String
Dim QueryId As Integer

QueryName =
Cache("dsQueries").tables(0).Rows(e.CommandName).i tem("QueryName")
QueryId =
Cache("dsQueries").Tables(0).rows(e.CommandName).i tem("QueryId")

Dim q As New Query(QueryName, QueryId)

Session("CurrentQuery") = q

CType(GridView1.Rows(e.CommandName).FindControl("Q ueryName"),
LinkButton).PostBackUrl = "Flow.aspx"

Response.Redirect("Flow.aspx")

End Sub

Mar 8 '06 #1
0 1409

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

Similar topics

14
by: Daniel Chartier | last post by:
Hello. I work in the paper industry and we recently had someone (the original author) from within the company make a program for preventive maintenance. However, it had some bugs and we wanted...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
43
by: Dave Vandervies | last post by:
Seen in a chunk of code I was looking at recently (not mine!): -------- char* imgfilename; sprintf((char*)imgfilename, "mask%d.dib", params.profile); ReadImage((char*)imgfilename); --------...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
26
by: Bill Reid | last post by:
Bear with me, as I am not a "professional" programmer, but I was working on part of program that reads parts of four text files into a buffer which I re-allocate the size as I read each file. I...
2
by: hg | last post by:
Hi, I posted an equivalent question earlier ... but am still not sure: I currently (under Linux) have a program that uses Queue.put (raw_input('')) in a signal handler and Queue.get() in the...
4
tpgames
by: tpgames | last post by:
I'm trying to make the code work with images, and work without using dates. I'm trying to alter someone elses script. The board doesn't show up with images. Thanks! <script type="text/javascript">...
9
by: Cliff | last post by:
I've got a number of SNMP devices scattered around the globe that I want to get some information off.. I've got a couple of classes whcih get a quite complex table together from SQL and SNMP...
4
tolkienarda
by: tolkienarda | last post by:
hi all i came to work for the company i work for now in september and they have a lot of Dreamweaver generated ASP, PHP and Javascript. as well as some other scripts that no one understands but...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.