Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["FarmerCode"].ToString()))
            {
                lblFarmerCode.Text = Request.QueryString["FarmerCode"].ToString().Trim();
            }
            else
            {
                lblFarmerCode.Text = string.Empty;
            }
            if (!string.IsNullOrEmpty(Request.QueryString["BackUrl"].ToString()))
            {
                btnBack.PostBackUrl = Request.QueryString["BackUrl"].ToString().Trim();
            }

            ListItemCollection items = MudarApp.BindYear();
            foreach (ListItem item in items)
            {
                ddlSeasonYear.Items.Add(item);
            }
            ddlSeasonYear.Items.RemoveAt(0);
            BindFarmer();
        }
    }
Exemple #2
0
    private void BindYears()
    {
        ListItemCollection items = MudarApp.BindYear();

        foreach (ListItem item in items)
        {
            ddlyear.Items.Add(item);
        }
        ddlyear.SelectedValue = DateTime.Now.Year.ToString();
    }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Master.MasterControlbtnFarmerPlantation();
         ListItemCollection items = MudarApp.BindYear();
         foreach (ListItem item in items)
         {
             ddlFarmerYear.Items.Add(item);
             ddlAllFarmerYear.Items.Add(item);
             ddlFPYear.Items.Add(item);
         }
         ddlUnitDetails.DataSource     = fp.BindDropDownChild();
         ddlUnitDetails.DataTextField  = "Name";
         ddlUnitDetails.DataValueField = "UnitId";
         ddlUnitDetails.DataBind();
         BindddlCultivation(1);
         gvFarmerList.DataSource = far.FamerDetails();
         gvFarmerList.DataBind();
     }
 }
    //private void BindSeaDetailsList()
    //{
    //    ddlSelectSeason.DataSource = cp.GetSeasonDetails();
    //    ddlSelectSeason.DataTextField = "SeasonName";
    //    ddlSelectSeason.DataValueField = "SeasonID";
    //    ddlSelectSeason.DataBind();

    //    ddlSelectSeason.Items.Insert(0, MudarApp.AddListItem());
    //}
    private void BindSeasonYear()
    {
        ListItemCollection items = MudarApp.BindYear();

        foreach (ListItem item in items)
        {
            ddlSeasonYear.Items.Add(item);
        }
        ddlSeasonYear.DataBind();
        ddlSeasonYear.SelectedValue = DateTime.Now.Year.ToString();

        //ListItemCollection items = MudarApp.BindYear();
        //foreach (ListItem item in items)
        //    ddlSeasonYear.Items.Add(item);
        //for (int count = 0; count < Convert.ToInt32(WebConfigurationManager.AppSettings["SeasonYearCount"].ToString()); count++)
        //    ddlSeasonYear.Items.Add((new ListItem()).Text = DateTime.Now.AddYears(count).Year.ToString());
        //ddlSeasonYear.DataBind();
        //ddlSeasonYear.SelectedValue = DateTime.Now.Year.ToString();
        //DataTable temp = cp.GetSeasonDetails();
        //if (temp.Rows.Count > 0)
        //{
        //    ddlSeasonYear.DataSource = temp.DefaultView.ToTable(true, "SeasonYear");
        //    ddlSeasonYear.DataTextField = "SeasonYear";
        //    ddlSeasonYear.DataValueField = "SeasonYear";
        //    ddlSeasonYear.DataBind();
        //    string currYear = Convert.ToString(DateTime.Now.Year);
        //    IEnumerable<DataRow> query = temp.AsEnumerable().Where(m => m.Field<int>("SeasonYear") == DateTime.Now.Year);
        //    if (query.Count() <= 0)
        //    {
        //        ListItem lstItem = new ListItem(currYear, currYear);
        //        ddlSeasonYear.Items.Add(lstItem);
        //        ddlSeasonYear.DataBind();
        //    }

        //    ddlSeasonYear.SelectedValue = currYear;
        //}
    }