Good evening, apologies for the apparent simpleness of my 'problem', i'm quite new to coding in .net and I think its confusing me a little.
I have a page with a gridview and a dropdown (postback) box listing the dates available to filter the grid by with the newest first.
However i'd also like the user to be able to 'jump' to the page by using a query string so they dont have to go to the page and then filter ie
http://localhost/view.aspx?date=01/04/2008
They can then use the dropdown to select a different date should they need to.
Pretty simple so far and i've managed to get the above working with the below in pageload
Code:If Not IsPostBack Then If IsDate(Request.QueryString("date")) Then If DropDownList1.Items.FindByText(Request.QueryString("date")) Is Nothing Then DropDownList1.Items.Add(New ListItem(Request.QueryString("date"), Request.QueryString("date"))) End If DropDownList1.SelectedValue = Request.QueryString("date") Else DropDownList1.SelectedIndex = 0 End If End If
My question is really should I be using postback in the dropdown if im using a querystring? Theres something that doesn't sit right with me showing the date in the url but showing a different dates data in my page
Should I drop the postback and stick with loading the new url when the dropdown changes and solely use the querystring? i'd just use the newest date if the date querystring was invalid or missing.
It there anything wrong with the current solution and will I lose functionality not using postback on the dropdown? It just doesn't seem very graceful.
I've walked away and made a cup of tea and I still can't get my head around what should be an easy thing to solve (me being too fussy I guess)
Thanks for any pointers.





Bookmarks