public void Bind()
        {
            DataTable dt = objcust.GetAllCustomers();

            GridViewcustomer.DataSource = dt;
            DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CommonFunction objcmn = new CommonFunction();
         TxtRentTransno.Text = objcmn.GenerateRentTransNo();
         CustomerDetails objcust = new CustomerDetails();
         DataTable       dt      = objcust.GetAllCustomers();
         DataRow         row     = dt.NewRow();
         row["CustomerId"]   = 0;
         row["CustomerName"] = "--Select Customer--";
         dt.Rows.InsertAt(row, 0);
         DropDownList2.DataSource     = dt;
         DropDownList2.DataTextField  = "CustomerName";
         DropDownList2.DataValueField = "CustomerId";
         DropDownList2.DataBind();
         Item      objitem = new Item();
         DataTable dt_itm  = objitem.GetAllItem();
         DataRow   row1    = dt_itm.NewRow();
         row1["ItemId"]   = 0;
         row1["ItemName"] = "--Select Item--";
         dt_itm.Rows.InsertAt(row1, 0);
         DropDownList1.DataSource     = dt_itm;
         DropDownList1.DataTextField  = "ItemName";
         DropDownList1.DataValueField = "ItemId";
         DropDownList1.DataBind();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable dt = objcust.GetAllCustomers();

            Label1.Text = dt.Rows.Count.ToString();

            DataTable dt_itm = objitem.GetAllItem();

            Label2.Text = dt_itm.Rows.Count.ToString();
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Bind();
                CustomerDetails objcust = new CustomerDetails();
                DataTable       dt      = objcust.GetAllCustomers();
                DataRow         row     = dt.NewRow();
                Item            objitem = new Item();
                DataTable       dt_itm  = objitem.GetAllItem();
                DataRow         row1    = dt_itm.NewRow();
                row1["ItemId"]   = 0;
                row1["ItemName"] = "--Select Item--";
                dt_itm.Rows.InsertAt(row1, 0);
                DropDownList1.DataSource     = dt_itm;
                DropDownList1.DataTextField  = "ItemName";
                DropDownList1.DataValueField = "ItemId";
                DropDownList1.DataBind();

                //DataTable dt_rent = objrent.GetRentToGrid();
                //GridViewRental.DataSource = dt_rent;
            }
        }