Example #1
0
    private void VincularTipo()
    {
        Tipos      ct  = new Tipos();
        SqlCommand cmd = ct.getTiposcmd();

        SqlDataAdapter sda = new SqlDataAdapter(cmd);
        DataTable      dt  = new DataTable();

        sda.Fill(dt);

        if (dt.Rows.Count != 0)
        {
            ddlTipo.DataSource     = dt;
            ddlTipo.DataTextField  = "nombre";
            ddlTipo.DataValueField = "id";
            ddlTipo.DataBind();
            ddlTipo.Items.Insert(0, new ListItem("-Seleccionar-", "0"));
        }
    }