Sunday, 15 August 2010

c# - getting the value of the DropdownList ID -


I have the following loop, which is displaying several DropdownLists

  @for (int i = 0; I & lt; Model. Patternbrushes Multiplayer Def.Count; I ++) {& lt; Tr & gt; & Lt; Td> @ Html.DisplayFor (x = & gt; Model.Passion Attributes Multiplayer Def [i] .PositionId) & lt; / Td> @for (Int J = 0; j & lt; model. Rcnaatrybs Malteepliyr Def [i]. Atrybbijhnkkount; j ++) {& lt; TD & gt; @ Html.DropDownListFor (M = & gt; m.AttribId, New selectList (new [] { "0", "1", "2", "3", "4"}, Model.PositionAttribsMultiplierDef [i] .AttribsByPosition [j] .AttributePlayerPosMult.ToString ()), new {id = Model.PositionAttribsMultiplierDef [i] .PositionId + "_" + Model.PositionAttribsMultiplierDef [i] .AttribsByPosition [J]} KAttributeId) & Lt; / TD & gt; } & Lt; / Tr & gt; }  

And I'm managing to get the selected value in the model, which is to me: -

  public String [] AttribId {get ; Set; }  

Now I want to get the ID of dropdown list I, so I can attach this AttribID, for example "0" or "1" or "2" and so on ID To do that, something like "CB_Cor" will be.

Ideally then I want to get a value such as "2_CB_Cor", and after that I want to parse this value and put it in the database.

So my question, how can I attach this value

  new {id = Model.PositionAttribsMultiplierDef [i] .PositionId + "_" + Model.PositionAttribsMultiplierDef [I]. AttribsByPosition [J] .ttributeId}  

m.AttribId

Thank you for your help and time! To


No comments:

Post a Comment