Beispiel #1
0
    private async Task loadCategories(serviceDAO service)
    {
        List<Category> category = await service.GetAllCategories();
        ddlCategory.DataSource = category;
        ddlCategory.DataValueField = "Id";
        ddlCategory.DataTextField = "Name";
        ListItem selec = new ListItem("Select...", "0");

        ddlCategory.DataBind();
        selec.Selected = true;
        ddlCategory.Items.Insert(0, selec);
    }
Beispiel #2
0
    private async Task loadCategories(serviceDAO service, int init, int currentPage)
    {
        List<Category> categorias = await service.GetAllCategories();
        int fin = init + gvCategories.PageSize;
        if (categorias != null && fin > categorias.Count)
            fin = categorias.Count;
        gvCategories.PageIndex = currentPage;

        gvCategories.DataSource = categorias;
        gvCategories.DataBind();
        for (int i = init; i < fin; i++)
            ((ImageButton)gvCategories.Rows[i].Cells[3].Controls[0]).Attributes.Add("OnClick", "if(!confirm('The entry will be deleted, are you sure?'))return false;");
    }