Back to the previous binding of the list box - c#

I had few reading about how to navigate between pages and using the back button.
What I try to do actually is implementing one of my button on the tap event to go back to the previous list box items.
I mean, I bind folders on my listbox. When I click on an item I load the subfolders so the itemssource is changing.
How can I , when i click on the back button, display the previous itemsource of the listbox ?
Should I use history ? Everything is on the same page, so i definitly can't use this navigate method .

You could hook into the OnBackKeyPress method and alter the ItemsSource, you need to make sure that you can exit your application sucessfully if you went down this route :-
http://msdn.microsoft.com/en-us/library/microsoft.phone.controls.phoneapplicationpage.onbackkeypress(v=vs.92).aspx

Related

Panorama Page Layout Change? Windows Phone 7

Is there a way to know when the panorama view gets changed from say a current title "Settings" to "Help"? I need this so I know what view to open if they click the add button or remove appbar buttons.
So lets say we got a panerama view like:
How can we know when the user changed from the recent part to the part the phone is currently on or the network part?
The Panorama control raises a SelectionChanged event each time the user navigates from one PanoramaItem to the next. You can then determine the index of the current page by inspecting the SelectedIndex property.
PanoramaControl has a property called SelectedIndex, which gives the index of the currently selected PanoramaItem. By this index you can decide which page has been selected.

How to access value of list box?

I have update panel which gets updated on button click event. Out of the update panel,there is list box. When user clicks on the button which is placed inside update panel, at that time I want to retrieve selected items from the list box, but when I click the button, the selected index of list box is showing zero even if I select any item. I cant understand why it is happening so. Perhaps it is because partial update is taking place. How to tackel with this problem??
When you click the button, your page does a postback to the server on page_load and I think you are binding again. That's why the previous selection cleared. You should take care of the IsPostBack Condition while binding data to the listbox.

multicheck combobox with lost focus when select item :/

I try to use this example http://www.codeproject.com/KB/combobox/CheckComboBox.aspx to create multicheck combobox. Everything is all right, but when user select item in dropdown list it close and need another time click on it and select next item.
It is possible that when I fires onClick and dropdown show i t don't hide unless mouse lost focus on combobox ?
In the comments on the page you linked to, someone posted previously (August 2007) this exact question - and someone else responded with this alternative implementation as the solution: http://www.codeproject.com/KB/combobox/checkedcombobox.aspx

How do I override the OK/Cancel button of new list item form in SharePoint?

I have a custom list in SharePoint, and I want to override the OK/Cancel buttons that are in the New Item form (The form displayed when you click "New" in the default view of the list).
I want the saving logic to remain intact, but I just want to change the default page it redirects to, ideally, to a whole separate page on the site that's not a view of the list.
Is there any way I can achieve this?
Thanks in advance!
Depending on what you are looking for, a programmatic approach would be to write an Event Handler and after the ItemUpdated or ItemAdded event redirect to the location you want.
For more information
Ted Pattison MSDN Article on Event Handlers
Yes you can do that. [I guessing you are working with list]
Navigate to NewForm.aspx of that particular list
Open it for editing
Go to Data view Controls and drop Form action control to the form
Add Commit and navigate to page actions in sequence.

Obtaining selected item, value or index from drop down list in formview after button press

I have a formview with an insertion template. In this template there is a drop down list with a number of items I want users to be able to select from. Beside the drop down list there is a button which I am using to add the selected item from the drop down list to a gridview which also exists in the insertion template.
My problem is that when I click the button to add the selected item from the drop down list the selected item, index or value from the drop down list are not available. I am using a OnClick event handler to catch the event from the button click but I suspect there is some kind of refresh of the template going on here which I am not understanding as nothing appears to be accessible from the button event handler. I don't believe a postback is occurring as I have disabled the CausesValidation property for my button.
It seems like you are binding your DDL on postbacks as well. If the ddl data isnt hardcoded and you have the call for your ddl databind function in the Page_Load, you need to call the function like this to ensure it is not bound on postback:
if(!IsPostBack)
{
BindDDL();
}
Otherwise we need more information to help you and please post your code.
If you are clicking an asp:Button with an OnClick eevent attached to it then you are posting back to the server, no matter whether or not CausesValidation is true or not.
Are you binding data to the DropDownList? If so and you are rebinding it on postback then you'll not have the selected item you're expecting.
Can you paste us the code here?
I would have to see the code, but it sounds like you are getting a rebind prior to pulling the chosen items. One way to examine this is to add a watcha nd then make sure you code in the various ASP.NET events and then watch.
Without seeing what you are doing in code, I cannot tell if this is a drag and drop anomoly or something you have coded in. But the symptoms you are describing fits the typcial bind in Page_Load scenario, which is what jmein was aiming at.
So it turns it out it was all my fault. The formview control I have is contained in a panel which did not have view state enabled. This was preventing the drop down list from remembering the item I had selected it seems.
Thanks all for your comments and suggestions.

Categories