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.
Related
I'm having a dropdown in a ModalPopupExtender. The dropdown values are updated dynamically.
The problem is While clicking on the button in modal popup...The dropdown values was refreshed. So I tried to take the selected value of dropdown within the sectedindexchanged event. But If I put breakpoint with this also the control is not coming.
Can anyone tell me the fix for this?
SelectedIndexChanged is event triggered when the selection is changed, not when you change the items in the dropDown. for that you may use DataSourceChanged if you change the dataSource property or other, or other events, depend on what your code do ( please share it).
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
I have created a comboBox in my windows form that is auto filled by some database data. When i selected an index there are some label on the win form to capture other details of particular index. but the problem is when i click another control after making a selection , that combobox reset its value to one of my index.
There are two common causes for this:
Does the comboBox have a Leave or LostFocus event that is causing the change?
When you click the other control, is an event fired that will affect the comboBox, either directly or indirectly?
I have an ASP.NET repeater which contains grid view and a panel which contains save button.
the repeater displays grid and save button for each employee..
if there are 5 employees then 5 grids and 5 save button will be displayed.
Now i want to move the save button to Header.. in that case i'll have only one save button for all the grids..
if any grid is modified and i click the Save button, how can we know which grid is edited.
pls help.
If the grids don't post back, i'm not sure it's possible to know which grid was edited. You could add an hidden field to the page (asp:HiddenField) and modify the value using javascript and then check the hidden value when the save button is pressed. Also, why do you have a save button? The gridview has full support for CRUD (Create/Read/Update/Delete) operations.
i think you can use "for each" to loop throw all items in the repeater
and you can check if there is any change in the item then save it if not then leave it and move to the next item.
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.