Hi,
I have problem to get data using DropDownList.
After I selected date from DropDownList, then submit button, that DropDownList reset to 0 value.
I want to keep data even though I clicked submit button not to reset value which is "0".
Please check my code and help me how to hold data?
<h2 id="Choosedurrent">Choose Current</h2>
<select id="YearCu" name="YearCu" style="width: 150px;height: 40px;">
<option value="0">Please Select Year</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
<option value="Other">Other</option>
</select>
<br />
<select id="Month" name="Month" style="width: 150px;height: 40px;" onchange="this.form.submit()" >
<option value="0">Please Select Month</option>
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">Aug</option>
<option value="9">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
</td>
<td style="padding:20px;">
<h2 id="Comparess">Compare </h2>
<select id="YearCom" name="YearCom" style="width: 150px;height: 40px;">
<option value="0">Please Select Year</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
</select>
<br />
<select id="MonthCom" name="MonthCom" style="width: 150px;height: 40px;">
<option value="0">Please Select Month</option>
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">Aug</option>
<option value="9">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
<select id="txtOther01" name="Presetss" style="width: 220px; height: 40px; display: none;">
<option value="0">Please Select Preset</option>
<option value="ytd">Year-To-Date</option>
</select>
</td>
[HttpGet]
public ActionResult SalesGraph(string YearCu, string Month, string YearCom, string MonthCom, string Presetss)
{
var Username5 = User.Identity.Name;
ViewBag.Arrival = Month;
var ok1 = db.Users.Where(x => x.UserName == Username5).FirstOrDefault();
if (ok1 != null)
{
ViewBag.Ok2 = ok1.Po_Name;
ViewBag.Ok3 = ok1.Hired_date.ToString("MM/dd/yyyy");
ViewBag.Ok4 = ok1.Department2;
ViewBag.Ok5 = ok1.User_Point;
ViewBag.Ok6 = ok1.Name;
ViewBag.Ok9 = ok1.Pto_Point;
ViewBag.Ok10 = ok1.Personal_Leave;
ViewBag.Ity = db.Messages.Where(x => x.Isread == false && x.MessageTo == ok1.Name).Count();
if (ok1.Position_order <= 5)
{
ViewBag.Ok7 = "Manager";
}
if (ok1.Position_order == 3 && ok1.Department1 == "Retail Experience")
{
ViewBag.Ok8 = "Manager";
}
return View();
}