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.
Jaipal ReddyPosted Jun 22, 2015, 2:46 AM
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");
}
theLizardPosted Jun 21, 2015, 6:41 PM
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.
Upendra Pratap ShahiPosted Jun 21, 2015, 1:47 PM
Pankaj Kumar ChoudharyPosted Jun 21, 2015, 12:18 PM
Sujeet SumanPosted Jun 21, 2015, 6:46 AM
Bhushan BhasmePosted Jun 20, 2015, 11:17 PM