Form Submit Issue

  • Thread starter Thread starter Rob Meade
  • Start date Start date
R

Rob Meade

Hi all,

I have a page which displays some database results. On each column heading
I have 2 images, an arrow up, and arrow down for my data sorting.

The problem I have is that at the moment, the user enters search criteria
into the search box and clicks the search image button to trigger the
search. I now need the arrows to also submit the search - not the end of
the world, I can make them image buttons, but I have no idea how to send
dynamic sorting instructions via the querystring from the click of that
image button?

Can anyone help me please.

Thanks in advance,

Regards

Rob
 
I don't know if I'm understanding you correctly. But here's what I
think you should do.
First as you mentioned, make your images Image button controls. Then
you can do either one of these:
1. Return a dataset to fill your grid/table. Then when you click on the
soring image, just use the sort property of the defaultview element of
the dataset.
2. Call a different stored prcedure when you click the images.

In either case you don't need Querystring information, because you
won't be redirecting, but posting back to the same page.

I hope that helps
 
...
I don't know if I'm understanding you correctly. But here's what I
think you should do.
First as you mentioned, make your images Image button controls. Then
you can do either one of these:
1. Return a dataset to fill your grid/table. Then when you click on the
soring image, just use the sort property of the defaultview element of
the dataset.
2. Call a different stored prcedure when you click the images.

In either case you don't need Querystring information, because you
won't be redirecting, but posting back to the same page.

Hi Hugo,

Thank you for your reply.

I have a stored proc already, but it currently returns "under ordered", as I
have the DataView being sorted via the .Sort method.

I had assumed I'd need to trigger a reload of the page to resort, and as my
other page (not mentioned previously) resorts using a querystring (sending
the columns/order) to set the .Sort method I assumed I'd do it the same way.

I'm not sure whether I can do what you are suggesting though as my
ImageButtons for the sorting are being generated programmitcally, can you
add events for controls that are added programmaticaly?

Any further help appreciated.

Regards

Rob
 
I don't know if you can add an event to a dinamically generated
control. I'd say you can, but don't know how.
Now, if you want to send the information via the querystring. How about
generating the images as links, and then just look for the parameter
that you are sending to sort, and based on that you can use the sort
method of the dataview as you mentioned.
 
...
I don't know if you can add an event to a dinamically generated
control. I'd say you can, but don't know how.

Hi Hugo,

Yes, it appears you can...and cant...

You can use AddHandler to wire up and event handler to an event, ie
MyButton.Click etc

The problem is, from reading on the net, it seems that it only works if the
button is added in the Page.Load sub, not in any other subs of your own
(testing this at the moment), if so, this is no good to me...a work around
seems to be storing a value of the clicked item somewhere, say for example
in a form field or a session variable - just feels a sloppy way of doing
things to me..
Now, if you want to send the information via the querystring. How about
generating the images as links, and then just look for the parameter
that you are sending to sort, and based on that you can use the sort
method of the dataview as you mentioned.

Yeah, thats what I have on my "other" page, thats a nice one as it always
does the same thing, returns a specific set of results from the database, so
there I use the querystring/images to sort by, because there's no "form" as
such where the user can search, on this page however, if I do that then the
hyperlink on the image has to be something like:

MySearchPage.aspx?column=employee&order=desc

Downside of this is that then my search criteria is lost, as it is sent as a
form submission, more of a redirect.

I could of course put the search criteria in the querystring also, however
this is then changing my search page so much it doesn't feel like the right
solution (plus I'd have to add more validation of the querystring results,
and start populating form fields if there was a value in the querystring and
on it goes :))

Regards

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top