Setting selected value of DropDownList inside a repeater control

Hi everyone,

 I am binding a repeater control to a datatable.

 I bind 3 columns from the datatable to repeater columns. With an extra column being a DropDownList.

I like on the ItemDataBound event to read a datavalue from the current record that is not displayed/bound to the repeater control (call it column4) and once I read that value I like to set the selected value of the dropDownList Control

 

Many thanks in advance

 

 

1
clekkas
8/11/2008 2:57:48 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
3551 Views

Similar Articles

[PageSpeed] 12

 Hey,

 Well what you should do is find your item every time you want to read from the drop down list.
 So what basically happens is : you search for your item -  get the value.

hint : yourdatatableid.FindControl("yourddlid") or yourdatatableid.items[i].FindControl("yourddlid")    // it depends on your datatable, the items, and how you set it and how/when do u want to look for your item

 

 

 

 


Rod H
0
RodrigueH
8/11/2008 3:24:37 PM
Thanks I will give it a try
0
clekkas
8/11/2008 3:36:06 PM
Reply:

Similar Artilces:

Setting DropDownList controls inside a Datalist control
I have DropDownList controls inside a Datalist control.   I would be grateful if someone could tell me how to enable or disable a ListItem control accordingly with the  data contained in a DataTable.   Here are the ListItem controls:       <asp:ListItem Value="blue" >Blue</asp:ListItem>     <asp:ListItem Value="red" >Red</asp:ListItem>     <asp:ListItem Value="black" >Black</asp:ListItem>     <asp:ListItem Value="white" >white</asp:ListItem>   For i...

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...

binding selected value to dropdownlist in repeater control
I am trying to bind the SelectedValue of a dropdownlist in an itemtemplate of a repeater control.  The problem is that some of the values I'm binding to are not in the dropdownlist.  I want to say if the field I'm binding to is not in the list, don't bind and just select the first item as usual, otherwise bind.  Where and how would i say that.  I've tried binding using <%#Bind()%> and that doesn't look like it's going to work.  Thanks for all your help. Dear, friend: Would you plz dump some codes here?  Best Regards,____________________________________...

how can i Fill the controls on web page by selecting value from dropdownlist control.
  Hi,  Currentlly i am working on a web application where i require to fill the web form with the selected item in a text box. for example i have dropdown control named supplier_name, and i want to fill all the other controls values from database on the form when i select name from that supplier_name box,i.e , if i select name1, then related to that name, its code,address ,city should appear on related text boxes. I have done the same in windows application with c# , but the problem with web application(asp.net) is that, when i select Supplier _ it...

select control in a repeater control
Hi I have a repeater control which data are selected that way:  Strsql = "SELECT T_PRODUIT.NO_PRODUIT, T_PRODUIT.UNITE, T_PRODUIT.NO_CATEGORIE, T_PRODUIT.NO_CSBE,T_PRODUIT.NOUVEAU,T_PRODUIT.ID_PRODUIT, " & _ "CASE WHEN IMAGE IS NULL THEN 'Aucun.gif' ELSE IMAGE END AS IMAGE1, T_PRODUIT.NOM, " & _ "T_PRODUIT.DESCR, T_PRODUIT.DETAIL,T_FOURNISSEUR_PRODUIT.NO_FOURNISSEUR_PRODUIT, T_FOURNISSEUR_PRODUIT.PRIX, T_FOURNISSEUR_PRODUIT.PRIX_LISTE, " & _ "T_FOURNISSEUR.NOM as FNOM, T_FOURNISSEUR.NO_F...

How do I set the selected value of child DropDownList control cascading
 Hello i use ajax with  CascadingDropDown for 2 dropdownlist, one parent and the second chield  for save this informatio in data base is ok, no problem, the question is when i load this information from database to my aspx, i can put the selected value in the dropdownlist parent was very good, but when y tried to put the select value to the chield i have the problem, the razon is that the chield dropdownlist is no load ... how i can load the chiel dropdown for clien side,,  any examples please for example in the proyect http://www.asp.net/learn/ajax-videos/video-278...

Calendar Control inside Repeater, Handling Child control events in parent Data Control
Hi all,I've been researching a problem i have for a couple of days now and i'm still not sure how to even start to handle it.I'm essentially trying to build a page that will display custom form fields/controls for individual items/rows inside a repeater.I've got a fairly complex calendar i need to have working inside each individual row of the Repeater. The calendar is set up to fire the following events: OnDayRender="Calendar2_DayRender" OnSelectionChanged="Calendar2_SelectionChanged" OnVisibleMonthChanged="Calendar2_VisibleMonthChanged"My first question is how do i go about handling these...

Custom Control Inside a Repeater Control
I have a repeater control on the main page and would like to load a custom user control inside the repeater control. The custom user control is basically a GridView. A few values will need to be passed to the custom user control to define the where clause for the GridView DataSet. Can anyone provide me with or point me to a simple example of this functionality?Allan Horwitz Nevermind, I just put a GridView inside the Repeater Control tags and used the OnItemDataBound event to get the variables.Allan Horwitz...

How to access a control inside a Repeater control?
 <asp:Repeater ID="Repeater1" runat="server"> <HeaderTemplate><ul></HeaderTemplate> <ItemTemplate><li><asp:Image id="Image1" runat="server" /> </li></ItemTemplate> <FooterTemplate></ul></FooterTemplate> </asp:Repeater>   Protected Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound Dim Image1 As WebControls.Image Image1 = CType(e.Item.FindCo...

Problem in Using DropDownList Control to select a selected row of SqlDataSource that is under GridView Control
Hi all,In my SQL Server Management Studio Express, I have a database "ChemDatabase" that has a table "LabData"  formatted in the following way: SampleID int PRIMARY KEY, SampleName nvarchar(25), ChemicalName, nvarchar(25), Concentration decimal(6.2) with 5 rows of records in this .dbo table. In my Visual Web Developer Express, I created a website "RPD-TCE" for extracting a row of record from the LabData table by using a DropDownList, a GridView and a SqlDataSource.  I want to click DropDownList to list one number of S...

Set the property of a server control inside a user control inside a Master Page
How do you set the property(ForeColor) of a server control(lnkInquiryReport2) located in a user control (LeftNavMain1) within a Master Page (default.master)? On the user control, expose a property of type color and bind this to the forecolor for the hyperlink control [keep some default value]. On your master page expose the user control as a property. On your content page, access the uc via the master's prop and the forecolor prop via the uc's prop and set it. Instead of exposing the uc from the master, you can also find the uc on the master - cast it to the correct type and then access th...

how to set the cascading dropdownextendar value to the value of dropdownlist control
i have a cascading drop down extendar inside gridview , a dropdownlist control , a link button. i want to set the  value of dropdownextendar to the value of dropdown when i click the link button . <EditItemTemplate> <asp:DropDownList ID="ProvinceDDL" runat="server" /><act:CascadingDropDown ID="ProvinceCDD" runat="server" TargetControlID="ProvinceDDL" Category="Province" PromptText="- Please select a Province -" LoadingText="[Loading Province...]" ServicePath="LocactionService....

how to accessing values and set values for a controls that is inside a datagrid
hi this is chandra mohan working as software engineer . here i am having problem with accessing valuse and setting values for controls inside a datagrid. actually i am having datagrid and in this grid i am having item templates of one dropdwon list and text box. i having one Reset link buttion out side the grid(that is in the form) by clicking this Reset Link buttion it should invokes the javascript function and in that function it should set all textboxes of datagrid to  .. txtActionVal.readOnly = true;   txtActionVal.Value ="";and dropdownlist to  dropdownlist...

problem in selecting value from dropdown inside a repeater and inserting the selected value inside db
there is  checkbox and drop down inside my  item template of repeater in one page.Based on that drop down and check box selection calculation will be done in another page which will be inserted inside a db.I cannnot fetch the value from the dropp down in my save page  and as a resut data cannot be inserted inside db. plz help!!  <asp:Repeater ID="rptmenproduct" runat="server" >                      <HeaderTemplate>    <...

Web resources about - Setting selected value of DropDownList inside a repeater control - asp.net.presentation-controls

Tag Synonyms - Stack Overflow
Q&A for professional and enthusiast programmers

Accidental entities - what about the UI?
This post is a follow-up to my previous blog post " Accidental entities - you don't need that identity ". In that post, we followed a consultant ...

Flash Builder Plug-in for SAP Netweaver Gateway - Adobe Labs
Search Navigation Labs Home Wiki Home Technologies Alchemy Blueprint Camera Profiles and DNG Profile Editor Cirrus ColdFusion 10 DNG Codec Fireworks ...

Air Astana - Join Now
Thank you for considering membership of Nomad Club – Kazakhstan’s first Frequent Flyer Program. You could soon be on your way to earning free ...

Languages -> C# Articles, Tutorials, Examples: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Blog - Avisra
Avisra Web Development Home Blog Services Contact The Blog Latest Module Builder: How can we make it better? Sitefinity by Chris on July 2, 2013 ...

Online Booking Tool Support
This Online Booking Tool Support page might help you as you navigate through the process of booking travel through your OBT provided by CWT. ...

@Html and beyond
... ); } return string .Format( “{0}{1}” , me.Member.Name, id); } The Html building methods are quite simple. Building a dropdownlist for a ...

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Unit Testing DateTime.Now Without Isolation
public virtual void SeedWithYearsSince(DropDownList list, int year){ for (int index = year; index

Resources last updated: 12/14/2015 5:25:31 PM