c# - Getting DropDownList values in a repeater -


There is a following mark-up code:

ASPX page

 < Code> & lt; ASP: Repeater id = "GeneralRepeater" runat = "server" OnItemDataBound = "GeneralRepeater_OnItemDataBound" & Gt; & Lt; ItemTemplate & gt; & Lt; TR & gt; & Lt; TD & gt; Place: & lt; ASP: DropDownList ID = "GeneralDDL" DataTextField = "text" DataValueField = "Arena" runat = "server" / & gt; & Lt; / TD & gt; & Lt; Th & gt; & Lt; Asp: Button ID = "GeneralButton" runat = "server" Text = "Принять запрос" onclick = "GeneralButton_Click" / & gt; & Lt; / Th & gt; & Lt; / TR & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: Repeater & gt;  

code-behind

  protected void GeneralRepeater_OnItemDataBound (object sender, RepeaterItemEventArgs e) {if (e.Item.ItemType == ListItemType.Item || E Kaitmkitmteepe == Listitenteepekalternatingitm) {Dropdunlist Meeddl = (Dropdunlist) Ikaitmkfndkantrol ( "Generldl"); MyDDL.DataSource = lstArenaSelect; MyDDL.DataBind (); MyObject obj = (MyObject) e.Item.DataItem; Button General Button = (Button) E. ITEM FontControl ("General Button"); AcceptGeneralRequestButton.CommandArgument = obj.Id; }}  

This shows the initialization of each with the list of the objects of the DropDownList , and in the row that connects the row object.

object can get id

question

How do I GeneralButton_Click method In the dropdown list , get the value that is located in the same repeater line?

Thanks to everyone, I have used another approach:

  control parent = ((sender)). mother-father; DropDownList GeneralDDL = (DropDownList) parent.FindControl ("GeneralDDL");  

The code is called onclick button event handler.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -