Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Every one;

i ma trying to get a values of dropdownbox and checkbox from view to controller but i am not able to do that can any one help me out?

This View

XML
<td><input type="checkbox" name="'chk'@item.CountryDetails.CountryId" id="'chk'@item.CountryDetails.CountryId"  /></td>
                                   <td><select id="'DRP'@item.CountryDetails.CountryId" name="'DRP'@item.CountryDetails.CountryId"><option value="null">--Select time--</option>
                                   <option value="monthly">Monthly</option>
                                   <option value="yearly">Yearly</option>
                                   </select></td>



controller
XML
public ActionResult Index( FormCollection form)
 for (int i = 0; i < form.Count; i++)
                        {
                            {
                                WSH.CountryId = Convert.ToInt64(form.AllKeys[i]);
                            }
                            if (form["'DRP'" + WSH.CountryId] != null)
                            {
                                WSH.WSsheduled = form["'DRP'" + WSH.CountryId].ToString();
                            }
                            WSH.Scheduled = Convert.ToBoolean(form["'chk'" + WSH.CountryId]);
                            
                            schObj.Add(WSH);
                        }
}



this my Model

<pre lang="cs">public class Scheduling
    {
        public long CountryId { get; set; }
        public bool Scheduled { get; set; }
        public string WSsheduled { get; set; }
    }
Posted
Updated 26-Aug-14 1:46am
v5
Comments
Kumarbs 26-Aug-14 6:21am    
Improve your question, it is not understanding to respond. And get clear your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900