Hello,
Please help. I have a drop down menu from january to december using a combobox. I would like January to be read as 1, February as 2 and so on depending on the selection as my filtering in my database reads the month as the integer symbol. How may i be able to have the combobox string value be interpreted as the equated numeric value.

Bhushan BhasmeRank #2,348 · 604 reputationPosted Jun 20, 2015, 7:17 PM EDT
Sujeet SumanRank #790 · 2.9K reputationPosted Jun 21, 2015, 2:46 AM EDT
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Jun 21, 2015, 8:18 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 21, 2015, 9:47 AM EDT
theLizardRank #1,079 · 1.8K reputationPosted Jun 21, 2015, 2:41 PM EDT
string[] m = { "January", "February", "March", "April" ... };
for (int i = 0; i < 12; i++)
{
if (m[i] == comboBox1.Items[comboBox1.SelectedIndex])
{
j = i + 1;
break;
}
}
Keep it simple.
Jaipal ReddyRank #588 · 4.1K reputationPosted Jun 21, 2015, 10:46 PM EDT
DataSet ds = new DataSet();
ds = new BL_Month().GetMonthLIST();
if (ds.Tables.Count > 0 && ds != null && ds.Tables[0].Rows.Count > 0)
{
ddl.DataSource = ds;
ddl.DataValueField = "MonthId";
ddl.DataTextField = "MonthName";
ddl.DataBind();
ddl.Items.Insert(0, "Select");
}