Retaining Current Values Of DropDown List inside a Form View Control

I have two dropdownlist controls inside a formview control which lists the "genre" and "rating" for a video game.  The two dropdownlist are bound to an objectdatasource which extracts the "genre" item and "rating" item. I also set the property "AppendDataBoundItems" to "true" becaue i want the user to be able to change the current value of the list. With this in mind, i manually added "listitems" in order for the user to have a selection of all the "genre" and "rating" fields. My problem is when i go into the edit template, the data bound item is not selected but is at the very bottom of the dropdown list. How do i set the extracted value from the objectdatasource to be selected by default even after i manually added my own listitems to the drop down list? Please any help would be appreciated. Thanks in advance.

10/24/2006 4:47:31 PM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 29


In the PreRender event you can use FindControl to get the DDL in the editTemplate and set the SelectedValue

if(this.FormView1.CurrentMode == FormViewMode.Edit)


 // find the ddl and set the selectedValue


Best Regards,
Rex Lin
Microsoft Online Community Support

This posting is provided "AS IS" with on warranties, and confers no rights.
10/25/2006 4:31:11 AM

Hey Rex! Thanks for the quick response. I tried your solution and it worked! Cheers!



10/25/2006 5:36:18 AM

Similar Artilces:

how do i bind data from database using dropdown list inside the form view control
i'm using ASP.Net 2.0.i'm trying to create 1 asp page for bind the data from data base using dropdown list inside form view control.i'm using 2 dropdown list controls second DDL will bind the data depends on first DDL but i can't do.if any one is there to clear my doubt means send me the code in c# sharp language to my email address r this forum...thank u...   Regards, Aani Hi Aani, I wrote a detailed post with code you can look at for this, but using a gridview.  It's very similar.  Take a look.

obtaining the value of a dropdown control inside a gridview control
Hi, I am working on a site to process assessments against a particular business service. The assessments have 8 stages and there are questions for each stage with a list of responses. I am experimenting with different user interfaces for doing this and am open for suggestions on the best way, but for the moment I have a page for each assessment with a dropdown list containing stage 1-8, on selecting a stage a gridview is built containing the questions and responses for that particular stage. So the first column is the question and the second column a drop down list of possible responses, o...

TextBox control not retaining values inside Wizard Control
I might be doing someting very silly. I have a wizard control. Everthing works fine on Wizardstep 1 . But on the step 2 I have some TextBoxes and a Button. When I click on the button a page postback happens and then there is nothing in the TextBox.Text property in the code behind.   Thanks I notice the status of this thread is “Resolved”, is it marked yourself? If so, please post your answer in order for others member learn from it.  We will greatly appreciate all your sharing.Hong-Gang ChenMicrosoft Online Community SupportPlease remember to mark the replies as answers if the...

when loading a previously created record on to form, some controls are missing values(controls are depended on values selected in other controls)
Hello - I have created a page for Editing records.  this page will open up a chosen record and allow user to edit the data.On the form, I have 3 drop down lists.   The second dropdown list should fill values depending on value chosen in first dropdown list.  The third dropdown list should show/fill values depending on value chosen in second dropdown list.So taking this into count, i have several records with various data.  When I open-up/load a record in Edit form, only the first dropdown list has a value selected that was the pre-existing va...

Drop down list in Form view returns error when value in bound field (data binding
I get the following error when I click edit to edit the details in the web form:'ddlUserRestrictionType' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value  I would like it to accept any value which currently exists in the database. Is this easily achievable? With what you've posted, all I can tell is that you are trying to set the SelectedValue of a ddl to a value that does not exist in the list.  It would be helpful if you can post some code and the expected values of this control.~ Timwww.bucketo...

Form view containing a User Control on which a dropdown list is drawn
Greetings -   I have a user control inside a formview InsertItemTemplate.  On the User Control I have a dropdownlist.   When I select an item from the dropdown list,  the selected index changed event, inside the user control, fires; however, the selected value is empty.  I've tested the usercontrol in a test page (just the user control), and the selected value does appear when the SelectedIndexChanged event is fired.   This problem seems to have something to do with the user control being placed in the formview. I'd appre...

How to RenderView to a View other than your current Controller View list
I want to do a RenderView to a completely different controller's View from within one of my current controller's methods.  How do I do this? When is Microsoft going to get rid of VB.NET! RedirectToAction("actionname", "controllername")??David Kiff "Mark As Answer" If my reply helped you -- Alternatively move the view to the Views/Shared folder, it can then be used by any controller.Richard RedirectToAction seems appropriatePerhaps there should be a RenderView(action, controller, viewdata) overload ??but you can a...

Listing Form controls in user control
Hi all ,          I am trying to create a web user control with a public property of ControlToBind In that I am interested to list the controls avalible in the from...   How can i do this   Pls note that when a new control is added the form the user control in the form has to updated auto   Thanks in Advance DanaRemember to click "Mark as Answer" on the post that helps U Or How can I add a dropdownlist items as a property to the Usercontrol ?Remember to click "Mark as Answer" on the post that helps U Hi ...

Control values not retained in user control
Hi there,I have a user control on my main page that contains a form for creating/editing records in a popup.  Whenever the popup is closed I want to clear out the form to prepare it for re-use.  To do this I have added a public "Reset" method to the user control that sets all the form fields to empty strings, and is called from the main page.  I have stepped through my code and the Reset method is being executed and re-setting the control values, but when the control is re-loaded (i.e. the popup is opened to create/edit a new record) the old values are displayed.Does...

Gettting the clientID form a control inside a control
I am trying to get the control that resides inside another control because I need to pass those clientIDs to a javascript function to the client. <script type="text/javascript"> init_newProject("<%= FormView_ProjectProperties.findControl("txt_startDate").ClientID %>") </script>   But I get the following compilation error :  CS0117: 'System.Web.UI.WebControls.FormView' does not contain a definition for 'findControl'  checkout: Thanks,Karan~ Remember...

validating controls inside data list control
 Hi I have some text boxes inside data list control and I want to validate them for correct values. How can this be done? u can achive this by using javascript validation for the textboxes.Uthappa T.PC# .NetVisual Studio 2008 Place a Data validation control and assign same validation group to it. On Save button set causesvalidation=true and validation group equal to validation group assigned in validation controlsZeeshan Umar~ Please Mark as Answer if it solves your query ~  ThanksI have solved the problem. It's simple just place the validation controls inside the <It...

Control.Value and Control.SelectedItem.Value
Can someone explain to me the difference between say, Dropdownlist.SelectedItem.Value and Dropdownlist.SelectedValue?? Just curious, Thanks!Tim These are going to return the same thing. dropdownlist.selectedvalue is a shortcut to get the currently selected value in the dropdown. If that is all you want then you can just use that. If you want to access the currently selected item you can use dropdownlist.selecteditem and that return the item and you can then access any of the item's properties, including in this case the value property. If this post answered your question please r...

dropdown list control value
Hopefully what I'm trying to do is possible. I have a dropdown list control that i'm populating with values through a MS SQL data base. What I'm actually doing is creating a page where I can edit values in the database that were previously entered through another form. Now I need to populate/bind the dropdown list box and after that I want to set it's displayed value to that of the current records value in the database. This will allow the user to see the current value stored in the database and if they change the selection I will update the datebase. Here is my current code: 'Populate...

using a .Net Control as activex control in VCL form
Hi , We have a to integrate a simple .Dot CSharp control which needs to be integrated into bcb2010 VCL form as a control. We will place the control on the VCL form along with other VCL controls's. I tried creating a simple .net control using a lable+textbox and trying to use in vcl form. I have made the assembly comvisible and generated tlb files and .bpl for the component. I could see the component in "ActiveX" tool palette. But when I drag the object onto VCL form and try to access its attributes I run into problems. I am not able to see .net control on the vcl at runti...

Web resources about - Retaining Current Values Of DropDown List inside a Form View Control -

Retaining wall - Wikipedia, the free encyclopedia
... on the opposite side. The walls must resist the lateral pressures generated by loose soils or, in some cases, water pressures . Every retaining ...

Western Sydney confident of retaining Ono
WESTERN SYDNEY are in no rush to extend Shinji Ono's contract despite the threat of losing the Japanese star to a rival A-League club at the ...

Raiders hope cutting prices will be just the ticket to retaining members
The Raiders will cut their cheapest adult ticket price at the turnstiles by 34 per cent in an attempt to make NRL games more affordable next ...

North Queensland Cowboys 2015 NRL premiers: Peter Parr confident of retaining grand final side long term ...
NORTH Queensland supremo Peter Parr is quietly confident the club can keep cashed up rivals at bay despite up to nine of their grand final winning ...

Fox Sports and Seven tie up AFL rights in $2.5bn deal with Telstra retaining digital rights
News Corp owned Fox Sports and Seven Network have tied up the rights for the AFL for six years for a record breaking $2.508bn, double the previous ...

Australian Rugby Union confident of retaining Israel Folau 'longer-term'
The Australian Rugby Union is confident it can fend off a raid from the NRL and lock in dual international Israel Folau for as long as three ...

Tips for retaining employees from Takor’s Amir Farhand
Australian geospatial startup Takor has been operating for nearly seven years now and CEO Amir Farhand says he’s yet to lose one employee.

Essendon Bombers still hopeful of retaining Jake Carlisle and Jake Melksham
Essendon have not given up hope of convincing wantaway duo Jake Carlisle and Jake Melksham to stay now that John Worsfold has been installed ...

Right move in retaining telco bar
THE Abbott government has made the right call in continuing Labor's ban on participation in the NBN network by the Chinese telco giant Huawei. ...

Rio Tinto's Andrew Harding confident of retaining lowest iron ore costs
Rio Tinto's iron ore head says a proactive strategy on technology will stand it in good stead to preserve its ranking as the lowest cost producer ...

Resources last updated: 1/15/2016 4:16:08 PM